Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Storing username with cloud variables?
- swillia1
-
Scratcher
6 posts
Storing username with cloud variables?
Okay, I was planning on making a game with cloud highscores joined with usernames, BUT, I don't know how. If you could reply, that would be great, thank you, bye!
when green flag clicked
forever
Go to url (http://scratch.mit.edu/users/swillia1/)
Do thing (ROCK OUT!!)
end
Last edited by swillia1 (Sept. 4, 2014 22:37:37)
- turkey3
-
Scratcher
1000+ posts
Storing username with cloud variables?
Encoding and Decoding Cloud Data on the Wiki. 

- hppavilion
-
Scratcher
100+ posts
Storing username with cloud variables?
I've done this before. My strategy is to create a variable
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
It starts by setting i, which is a variable representing which letter is being encoded, to zero along with where it's encoding it to. Then, it repeats a process until the entire username has been encoded. i is increased by one to say that the next letter is currently being used. It also resets i2, which is used to find the symbol to encode. It then increments i2 by 1 until it finds what the position of the symbol to be encoded is. It then takes said numer, makes sure it's two symbols long (if it's 1, it adds a zero to the beginning) so that it can be properly decoded. Then it just joins i2 in to the Top Score variable and repeats the process on the next letter.
So to decode it:
To create a list of people, you just need to use a list-to-variable and variable-to-list compressor/decompressor beforehand. I won't explain how to make the decompressor here, but you compress it like this:
To decompress, you just need to figure out how to copy every item until the separator then add the everything, skip the separator, and start the next list item.
(symbol index)which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
set [i v] to (0)So what's going on here?
set [☁Top Score v] to []
repeat until <(i) = (length of (username))>
change [i v] by (1)
set [i2 v] to (0)
repeat until <(letter (i) of (username))=(letter (i2) of (symbol index))
change [i2 v] by (1)
end
if <(length of (i2) = (1)> then
set [i2 v] to (join (0) (i2))
end
set (☁Top Score) to (join (☁Top Score) (i2))
end
It starts by setting i, which is a variable representing which letter is being encoded, to zero along with where it's encoding it to. Then, it repeats a process until the entire username has been encoded. i is increased by one to say that the next letter is currently being used. It also resets i2, which is used to find the symbol to encode. It then increments i2 by 1 until it finds what the position of the symbol to be encoded is. It then takes said numer, makes sure it's two symbols long (if it's 1, it adds a zero to the beginning) so that it can be properly decoded. Then it just joins i2 in to the Top Score variable and repeats the process on the next letter.
So to decode it:
set [i v] to (0)This one is noticeably simpler. It resets i and the output variable, then it just changes i by two then finds the number pair and joins the letter in the index associated with said nuber pair into the output.
set [Decoded v] to []
repeat until <(i) = ((length of (☁Top Score))>
change [i v] by (2)
set [Decoded v] to (letter (join (letter ((i)-(1)) of (☁Top Score) (letter (i) of (☁Top Score)) of (Symbol Index))
end
To create a list of people, you just need to use a list-to-variable and variable-to-list compressor/decompressor beforehand. I won't explain how to make the decompressor here, but you compress it like this:
set [i v] to (0)That's simple. You just put a separator between each item.
set [compressed v] to []
repeat until <(i) = (length of [names v])>
change [i v] by (1)
set [compressed v] to (join (item (i) of (names)) [§])
end
To decompress, you just need to figure out how to copy every item until the separator then add the everything, skip the separator, and start the next list item.
- kbeaver12002
-
Scratcher
3 posts
Storing username with cloud variables?
when green flag clicked
forever
if <<[money] > [highscore]>> then
end
end
Last edited by kbeaver12002 (Sept. 24, 2019 17:25:37)
- deck26
-
Scratcher
1000+ posts
Storing username with cloud variables?
Please don't spam or necropost.when green flag clicked
forever
if <<[money] > [highscore]>> then
end
end
- EvanTheEevee543
-
Scratcher
75 posts
Storing username with cloud variables?
You cannot save words in a cloud variable due to the fact that you might be able to make a chat, the scratch team does not allow people to make chats.
- jaofoody1
-
Scratcher
66 posts
Storing username with cloud variables?
I've done this before. My strategy is to create a variablewhat are these red blocks? like what category are they because i cant find them(symbol index)which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.set [i v] to (0)So what's going on here?
set [☁Top Score v] to []
repeat until <(i) = (length of (username))>
change [i v] by (1)
set [i2 v] to (0)
repeat until <(letter (i) of (username))=(letter (i2) of (symbol index))
change [i2 v] by (1)
end
if <(length of (i2) = (1)> then
set [i2 v] to (join (0) (i2))
end
set (☁Top Score) to (join (☁Top Score) (i2))
end
It starts by setting i, which is a variable representing which letter is being encoded, to zero along with where it's encoding it to. Then, it repeats a process until the entire username has been encoded. i is increased by one to say that the next letter is currently being used. It also resets i2, which is used to find the symbol to encode. It then increments i2 by 1 until it finds what the position of the symbol to be encoded is. It then takes said numer, makes sure it's two symbols long (if it's 1, it adds a zero to the beginning) so that it can be properly decoded. Then it just joins i2 in to the Top Score variable and repeats the process on the next letter.
So to decode it:set [i v] to (0)This one is noticeably simpler. It resets i and the output variable, then it just changes i by two then finds the number pair and joins the letter in the index associated with said nuber pair into the output.
set [Decoded v] to []
repeat until <(i) = ((length of (☁Top Score))>
change [i v] by (2)
set [Decoded v] to (letter (join (letter ((i)-(1)) of (☁Top Score) (letter (i) of (☁Top Score)) of (Symbol Index))
end
To create a list of people, you just need to use a list-to-variable and variable-to-list compressor/decompressor beforehand. I won't explain how to make the decompressor here, but you compress it like this:set [i v] to (0)That's simple. You just put a separator between each item.
set [compressed v] to []
repeat until <(i) = (length of [names v])>
change [i v] by (1)
set [compressed v] to (join (item (i) of (names)) [§])
end
To decompress, you just need to figure out how to copy every item until the separator then add the everything, skip the separator, and start the next list item.
- deck26
-
Scratcher
1000+ posts
Storing username with cloud variables?
They're just Scratchblock information that isn't recognised - either because they don't exist or they're not constructed properly. In this case they're just ‘letter of’ and join blocks.I've done this before. My strategy is to create a variablewhat are these red blocks? like what category are they because i cant find them(symbol index)which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
SNIP ————————–set [i v] to (0)SNIP ————————–
set [Decoded v] to []
repeat until <(i) = ((length of (☁Top Score))>
change [i v] by (2)
set [Decoded v] to (letter (join (letter ((i)-(1)) of (☁Top Score) (letter (i) of (☁Top Score)) of (Symbol Index))
end
Last edited by deck26 (May 21, 2020 08:13:16)
- TextToScript
-
New Scratcher
1 post
Storing username with cloud variables?
you have to make a list to access the red blocks, sorry if this topic is outdated, I just want to help people.
- ScratchLetters2020
-
Scratcher
100+ posts
Storing username with cloud variables?
when green flag clicked
forever
if <<[money] > [highscore]>> then
end
end
What!? I thought topics from Scratch 2.0 were archived. . . .
Last edited by ScratchLetters2020 (Oct. 2, 2020 21:07:59)
- Tiber3333
-
Scratcher
31 posts
Storing username with cloud variables?
when green flag clicked
say [I would like to know how to make a cloud username!]
- deck26
-
Scratcher
1000+ posts
Storing username with cloud variables?
Please create your own topic instead of necroposting.when green flag clicked
say [I would like to know how to make a cloud username!]
Usernames in the cloud have to be encoded. There is no such thing as a cloud username though, just a cloud variable being used to store information which may be a username or multiple usernames.
- Smanrocks
-
Scratcher
100+ posts
Storing username with cloud variables?
also some of the red blocks are blocks that appeared in scratch 3.0. the forums use 2.0 so some blocks exist even though they say they dontThey're just Scratchblock information that isn't recognised - either because they don't exist or they're not constructed properly. In this case they're just ‘letter of’ and join blocks.I've done this before. My strategy is to create a variablewhat are these red blocks? like what category are they because i cant find them(symbol index)which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
SNIP ————————–set [i v] to (0)SNIP ————————–
set [Decoded v] to []
repeat until <(i) = ((length of (☁Top Score))>
change [i v] by (2)
set [Decoded v] to (letter (join (letter ((i)-(1)) of (☁Top Score) (letter (i) of (☁Top Score)) of (Symbol Index))
end
- Discussion Forums
- » Help with Scripts
-
» Storing username with cloud variables?
