Discuss Scratch

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!

whenclickedforeverGotourlhttp://scratch.mit.edu/users/swillia1/DothingROCKOUT!!

Last edited by swillia1 (Sept. 4, 2014 22:37:37)

swillia1
Scratcher
6 posts

Storing username with cloud variables?

turkey3
Scratcher
1000+ posts

Storing username with cloud variables?

swillia1
Scratcher
6 posts

Storing username with cloud variables?

THANK YOU!!
hppavilion
Scratcher
100+ posts

Storing username with cloud variables?

I've done this before. My strategy is to create a variable
symbolindex
which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
setito0set☁Top Scoretorepeatuntili=lengthofusernamechangeiby1seti2to0repeatuntilletteriofusername=letteri2ofsymbolindexchangei2by1iflengthofi2=1>thenseti2tojoin0i2set☁TopScoretojoin☁TopScorei2
So what's going on here?
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:
setito0setDecodedtorepeatuntili=lengthof☁TopScore>changeiby2setDecodedtoletterjoinletteri-1of☁TopScoreletteriof☁TopScoreofSymbolIndex
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.

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:
setito0setcompressedtorepeatuntili=lengthofnameschangeiby1setcompressedtojoinitemiofnames§
That's simple. You just put a separator between each item.
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?

whenclickedforeverifmoney>highscorethen

Last edited by kbeaver12002 (Sept. 24, 2019 17:25:37)

deck26
Scratcher
1000+ posts

Storing username with cloud variables?

kbeaver12002 wrote:

whenclickedforeverifmoney>highscorethen
Please don't spam or necropost.
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?

hppavilion wrote:

I've done this before. My strategy is to create a variable
symbolindex
which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
setito0set☁Top Scoretorepeatuntili=lengthofusernamechangeiby1seti2to0repeatuntilletteriofusername=letteri2ofsymbolindexchangei2by1iflengthofi2=1>thenseti2tojoin0i2set☁TopScoretojoin☁TopScorei2
So what's going on here?
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:
setito0setDecodedtorepeatuntili=lengthof☁TopScore>changeiby2setDecodedtoletterjoinletteri-1of☁TopScoreletteriof☁TopScoreofSymbolIndex
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.

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:
setito0setcompressedtorepeatuntili=lengthofnameschangeiby1setcompressedtojoinitemiofnames§
That's simple. You just put a separator between each item.
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.
what are these red blocks? like what category are they because i cant find them
deck26
Scratcher
1000+ posts

Storing username with cloud variables?

jaofoody1 wrote:

hppavilion wrote:

I've done this before. My strategy is to create a variable
symbolindex
which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
SNIP ————————–
setito0setDecodedtorepeatuntili=lengthof☁TopScore>changeiby2setDecodedtoletterjoinletteri-1of☁TopScoreletteriof☁TopScoreofSymbolIndex
SNIP ————————–
what are these red blocks? like what category are they because i cant find them
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.

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?

kbeaver12002 wrote:

whenclickedforeverifmoney>highscorethen

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?

whenclickedsayI would like to know how to make a cloud username!
deck26
Scratcher
1000+ posts

Storing username with cloud variables?

Tiber3333 wrote:

whenclickedsayI would like to know how to make a cloud username!
Please create your own topic instead of necroposting.

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?

deck26 wrote:

jaofoody1 wrote:

hppavilion wrote:

I've done this before. My strategy is to create a variable
symbolindex
which would say something like this:
abcdefghijklmnopqrstuvwxwz0123456789-=\;',./!@#$%^&*()_+{}|:"<>?`~§ (Note the §. It's important.)
Then, you do something like this.
SNIP ————————–
setito0setDecodedtorepeatuntili=lengthof☁TopScore>changeiby2setDecodedtoletterjoinletteri-1of☁TopScoreletteriof☁TopScoreofSymbolIndex
SNIP ————————–
what are these red blocks? like what category are they because i cant find them
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.

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 dont

Powered by DjangoBB