Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloud data Encoding and decoding help!
- free_d
-
37 posts
Cloud data Encoding and decoding help!
Hi, I know that tutorials are not wanted on here but… I use a school Chromebook, and they have restricted the scratch wiki. So I can't look at tutorials on the wiki. Could someone give me a link to a tutorial, or make a tutorial on here. Thank You!
*Prefferation: Username cloud encoding and decoding*

- deck26
-
1000+ posts
Cloud data Encoding and decoding help!
It's really not difficult.
Set up a list with the characters you want to encode.
Loop through the input and for each character set variable V to the item number of that character in the list.
If V > 0 you have the code for that character. Assuming you have fewer than 100 characters you need to ensure V has two digits so if it's less then 10 join a 0 to the front of it.
Add that to the end of your code and move on to the next character.
Decoding is even easier. Get the first and second digit from the code and set variable V to that value. That will decode as item V from your character list. In the same way you built up the code you build up the decoded value - decode the first character as above and then move on to digits 3 and 4 to get the code for the next character and join that on.
Set up a list with the characters you want to encode.
Loop through the input and for each character set variable V to the item number of that character in the list.
If V > 0 you have the code for that character. Assuming you have fewer than 100 characters you need to ensure V has two digits so if it's less then 10 join a 0 to the front of it.
Add that to the end of your code and move on to the next character.
Decoding is even easier. Get the first and second digit from the code and set variable V to that value. That will decode as item V from your character list. In the same way you built up the code you build up the decoded value - decode the first character as above and then move on to digits 3 and 4 to get the code for the next character and join that on.
- MopperFat1
-
100+ posts
Cloud data Encoding and decoding help!
There are tutorial projects on scratch so you can use those. Here's a basic tutorial and you can just follow along with the series: https://scratch.mit.edu/projects/153372371/
- cm97417
-
46 posts
Cloud data Encoding and decoding help!
I Just went through Making my own Encoder and Decoder myself, for I am planning to use cloud lists as a save system
Assuming you want all the primary characters on a keyboard thats about 90+ characters not quite 100 though.
and if you want case sensitivity the trick I used was the costume trick, because costumes detect the difference between lower case and upper case.
you are gonna want a code that turns any number < 10 into a 2 digit form. e.g. V = 4 so Set V to 0 join V.
for case sensitivity I made all the costumes for the upper case letters ABCD… you get the idea but I added an extra one on the end lowercase.
if the costume remain lower case change the number by 26 assuming you do the lowercase alphabet straight after the uppercase one.
You want the Case sensitivity code /\/\/\/\ to occur everytime it finds the number ID for the character unless its > 26 or you might come across an issue where special characters !@#$… will appear as later characters in the code .<>?… which is what happened in my code XD.
for a decoding you want all the characters your using in a list in order of there number ID as well as Variable that lets you know what position of the code you are at and a Variable that stores 2 digit numbers. lets call them Code Index and Code Reader. have the Code index +1 in value and have the Code Reader Join the Value of the Letter at Code Index. once the Code Reader has 2 digits get it to find the letter in the list and put the Value into the Output Variable where the you should get the same value as what you put in. Input: Hello World Output: Hello World.
Assuming you want all the primary characters on a keyboard thats about 90+ characters not quite 100 though.
and if you want case sensitivity the trick I used was the costume trick, because costumes detect the difference between lower case and upper case.
you are gonna want a code that turns any number < 10 into a 2 digit form. e.g. V = 4 so Set V to 0 join V.
for case sensitivity I made all the costumes for the upper case letters ABCD… you get the idea but I added an extra one on the end lowercase.
if the costume remain lower case change the number by 26 assuming you do the lowercase alphabet straight after the uppercase one.
You want the Case sensitivity code /\/\/\/\ to occur everytime it finds the number ID for the character unless its > 26 or you might come across an issue where special characters !@#$… will appear as later characters in the code .<>?… which is what happened in my code XD.
for a decoding you want all the characters your using in a list in order of there number ID as well as Variable that lets you know what position of the code you are at and a Variable that stores 2 digit numbers. lets call them Code Index and Code Reader. have the Code index +1 in value and have the Code Reader Join the Value of the Letter at Code Index. once the Code Reader has 2 digits get it to find the letter in the list and put the Value into the Output Variable where the you should get the same value as what you put in. Input: Hello World Output: Hello World.
- cooldude-222
-
100+ posts
Cloud data Encoding and decoding help!
Here is a case sensitive on i made
https://scratch.mit.edu/projects/409031480/
https://scratch.mit.edu/projects/409031480/
- Discussion Forums
- » Help with Scripts
-
» Cloud data Encoding and decoding help!