top of page

How to Store Words In Cloud Variables on Scratch


BEFORE YOU MOVE ON...  PLEASE DO NOT MAKE ANY UNMONITORRATED CHATS USING CLOUD VARIABLES. IT IS AGAINST THE RULES.    IF ANYTHING DOESN'T MAKE SENSE, PLEASE ASK ME ABOUT IT THROUGH THE COMMENTS SECTION OF THE MAIN PROJECT.   THANK YOU!!



Step 1: Setting Up


First, add the letters A through Z (both capital and lowercase) and numbers 0 through 9 to the list “supported characters”. Then, add the numbers 0 through 26 to the list “supported characters numbers”. For every single digit number, make sure to place a zero in front (Ex. "1" becomes "01").


Step 2: Encoding Your Username


Drag these blocks onto the screen like so...

We are getting ready to set the value of the cloud variable, "highscore holder", which will, in the end, be your username encoded into numbers (that can be decoded too).





Now, let's construct what will be inside that empty space of "highscore holder".


If index equaled 3, this code will result in the letter "m". Do you understand?


This code searches for the specified letter, finds the index of that letter in "supported characters", then finds the corresponding number in the list "supported characters numbers"

Now, put this code inside of the code you previously constructed. The end result should look like this:

This code now converts your username to numbers to be stored in a cloud variable.

*NOTE: Make sure index is set to "1" before running this program :)


Step 3: Decoding Your Username Back to a Text String


The next step is to be able to decode the bundle of numbers you've just saved. One thing to note is that each character is represented by a two-digit number (ex. 01 or 24). Now, we need to find a way to tell the computer to treat two characters as one "code". Start this new piece of code.



Yay! You are almost done at this point!


This code will take that number and match it with the corresponding character from the "supported characters" list.


After adding the code above to the empty space in the "highscore holder's actual username that's not just numbers" variable, your code will look like this.




bottom of page