Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Converting text into Binary
- gaz-boy1
-
11 posts
Converting text into Binary
Hi, so i'm trying to convert a list composed of text into binary… i know im not very clear but if anyone could help that'd be awesome. 
basically what i want to do is have the user input text then it will add the text to a list and convert that item of the list to binary…
also id like to be able to change it back to text….

basically what i want to do is have the user input text then it will add the text to a list and convert that item of the list to binary…
also id like to be able to change it back to text….
- lederniersamourai
-
500+ posts
Converting text into Binary
1) put all characters (abcABC123+=-…) in a string variable
You can pack all those 4-digits in a big string. You can extract those code by extracting tje first 4 characters, then the next 4 ones, then …
When you want to decode the code into the original letter, you just have to subtract 1000, then you use this to get back the character:
set [chars v] to [ABCabc123?+=-... ]2) to code any character into just do the following:
set [index v] to [1]Then you can use the number inside the variable index as the decimal (or binary) code of the letter. If you want to have a fixed length for the code you can add 1000 for instance. In that case, All codes will be 4 digits numbers.
repeat until <(the_character) = (letter (index) of [chars])>
change [index] by (1)
end
You can pack all those 4-digits in a big string. You can extract those code by extracting tje first 4 characters, then the next 4 ones, then …
When you want to decode the code into the original letter, you just have to subtract 1000, then you use this to get back the character:
(letter (code) of [chars])
- theonlygusti
-
1000+ posts
Converting text into Binary
But that would require a binary->number->binary conversion, so I ask again, why binary? 1) put all characters (abcABC123+=-…) in a string variableset [chars v] to [ABCabc123?+=-... ]2) to code any character into just do the following:set [index v] to [1]Then you can use the number inside the variable index as the decimal (or binary) code of the letter. If you want to have a fixed length for the code you can add 1000 for instance. In that case, All codes will be 4 digits numbers.
repeat until <(the_character) = (letter (index) of [chars])>
change [index] by (1)
end
You can pack all those 4-digits in a big string. You can extract those code by extracting tje first 4 characters, then the next 4 ones, then …
When you want to decode the code into the original letter, you just have to subtract 1000, then you use this to get back the character:(letter (code) of [chars])
- gaz-boy1
-
11 posts
Converting text into Binary
thanks for your input guys, im not sure i fully understand yet…But that would require a binary->number->binary conversion, so I ask again, why binary? 1) put all characters (abcABC123+=-…) in a string variableset [chars v] to [ABCabc123?+=-... ]2) to code any character into just do the following:set [index v] to [1]Then you can use the number inside the variable index as the decimal (or binary) code of the letter. If you want to have a fixed length for the code you can add 1000 for instance. In that case, All codes will be 4 digits numbers.
repeat until <(the_character) = (letter (index) of [chars])>
change [index] by (1)
end
You can pack all those 4-digits in a big string. You can extract those code by extracting tje first 4 characters, then the next 4 ones, then …
When you want to decode the code into the original letter, you just have to subtract 1000, then you use this to get back the character:(letter (code) of [chars])

- gaz-boy1
-
11 posts
Converting text into Binary
*its because we dont have cloud data lists yet, so im converting each message into binary then storing it on a cloud variable then when someone runes the program it changes it back into text. or copy's it into the global chat list. whichever works.
- gaz-boy1
-
11 posts
Converting text into Binary
so yeah i just tried that and it crashed my web browser… http://scratch.mit.edu/projects/27880434/#editor
so what exactly is it doing?
so what exactly is it doing?
- Tropic
-
1000+ posts
Converting text into Binary
*its because we dont have cloud data lists yet, so im converting each message into binary then storing it on a cloud variable then when someone runes the program it changes it back into text. or copy's it into the global chat list. whichever works.
Binary means only 1's and 0's. Cloud data accepts numbers 0-9, not only 0's and 1's. Therefore, binary is not required

Just convert it into numbers instead of binary

- MegaApuTurkUltra
-
1000+ posts
Converting text into Binary
I would like to point out that numbers are already stored as binary in computer memory. So converting to numbers is actually converting to binary*its because we dont have cloud data lists yet, so im converting each message into binary then storing it on a cloud variable then when someone runes the program it changes it back into text. or copy's it into the global chat list. whichever works.
Binary means only 1's and 0's. Cloud data accepts numbers 0-9, not only 0's and 1's. Therefore, binary is not required
Just convert it into numbers instead of binary

- Tropic
-
1000+ posts
Converting text into Binary
I would like to point out that numbers are already stored as binary in computer memory. So converting to numbers is actually converting to binary*its because we dont have cloud data lists yet, so im converting each message into binary then storing it on a cloud variable then when someone runes the program it changes it back into text. or copy's it into the global chat list. whichever works.
Binary means only 1's and 0's. Cloud data accepts numbers 0-9, not only 0's and 1's. Therefore, binary is not required
Just convert it into numbers instead of binary
Yeah, well, I know that computers are using binary, but I just meant that converting it to binary yourself isn't necessary if the computer converts it to binary anyway

- gaz-boy1
-
11 posts
Converting text into Binary
I would like to point out that numbers are already stored as binary in computer memory. So converting to numbers is actually converting to binary*its because we dont have cloud data lists yet, so im converting each message into binary then storing it on a cloud variable then when someone runes the program it changes it back into text. or copy's it into the global chat list. whichever works.
Binary means only 1's and 0's. Cloud data accepts numbers 0-9, not only 0's and 1's. Therefore, binary is not required
Just convert it into numbers instead of binary
Yeah, well, I know that computers are using binary, but I just meant that converting it to binary yourself isn't necessary if the computer converts it to binary anyway
so maybe i should just ask for help on my project then, storing the text in a cloud variable somehow.
- Tropic
-
1000+ posts
Converting text into Binary
I would like to point out that numbers are already stored as binary in computer memory. So converting to numbers is actually converting to binary*its because we dont have cloud data lists yet, so im converting each message into binary then storing it on a cloud variable then when someone runes the program it changes it back into text. or copy's it into the global chat list. whichever works.
Binary means only 1's and 0's. Cloud data accepts numbers 0-9, not only 0's and 1's. Therefore, binary is not required
Just convert it into numbers instead of binary
Yeah, well, I know that computers are using binary, but I just meant that converting it to binary yourself isn't necessary if the computer converts it to binary anyway
so maybe i should just ask for help on my project then, storing the text in a cloud variable somehow.
Maybe you can just use someone elses encoder and decoder


You can also try to make an encoder & decoder yourself, but it might be hard. And you might need to use a block that runs without screen refresh to make it go faster too.
- StrawberryCoffee
-
25 posts
Converting text into Binary
Hi, so i'm trying to convert a list composed of text into binary… i know im not very clear but if anyone could help that'd be awesome.
basically what i want to do is have the user input text then it will add the text to a list and convert that item of the list to binary…
also id like to be able to change it back to text….
Hmm, I kinda forgot how to write binary. But I bet if you tell me what you would like I can convert it for you.

- StrawberryCoffee
- Discussion Forums
- » Help with Scripts
-
» Converting text into Binary