Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » A Guide on Using Strings in Cloud Variables
- SeptimusHeap
-
100+ posts
A Guide on Using Strings in Cloud Variables
An example can be found in the high score system here.
The overall system is very basic, we convert the name to a set of 2-digit numbers (01 = a/A, 02 =b/B). This system is expandable for uppercase characters but it would require a lot of duplicating and renaming blocks. I created 3 blocks to convert the name to numbers and back. First, a block that sets a variable, number to the number conversion of one letter. This block is several if statements that follow this format:
if <<letter = a> or <letter = A>>
set number to 01
end
The next block converts letters en masse to one large string, using a variable to cycle through every letter in the string, converting it to a number, and then joining this number with the rest. Then I set the cloud variable to the output.
The third and final block joins the first two numbers of the large, text-converted number and then searches on a list for the corresponding item (1 being a, 2 being b, etc.) and joins that with the rest of the string. This can be used to read the text from the variable.
The overall system is very basic, we convert the name to a set of 2-digit numbers (01 = a/A, 02 =b/B). This system is expandable for uppercase characters but it would require a lot of duplicating and renaming blocks. I created 3 blocks to convert the name to numbers and back. First, a block that sets a variable, number to the number conversion of one letter. This block is several if statements that follow this format:
if <<letter = a> or <letter = A>>
set number to 01
end
The next block converts letters en masse to one large string, using a variable to cycle through every letter in the string, converting it to a number, and then joining this number with the rest. Then I set the cloud variable to the output.
The third and final block joins the first two numbers of the large, text-converted number and then searches on a list for the corresponding item (1 being a, 2 being b, etc.) and joins that with the rest of the string. This can be used to read the text from the variable.
- blob8108
-
1000+ posts
A Guide on Using Strings in Cloud Variables
Are cloud variables stored as numbers, or as strings containing digits 0-9 (and one optional decimal point)?
EDIT: I'm really asking, can cloud variables store arbitrarily long numbers, and retrieve them intact?
EDIT: I'm really asking, can cloud variables store arbitrarily long numbers, and retrieve them intact?
Last edited by blob8108 (Sept. 8, 2013 13:41:01)
- Lilifant7253
-
1000+ posts
A Guide on Using Strings in Cloud Variables
here.I made a project that is working with a simular System. It can save some other signs too! An example can be found in the high score system
The overall system is very basic, we convert the name to a set of 2-digit numbers (01 = a/A, 02 =b/B). This system is expandable for uppercase characters but it would require a lot of duplicating and renaming blocks. I created 3 blocks to convert the name to numbers and back. First, a block that sets a variable, number to the number conversion of one letter. This block is several if statements that follow this format:
if <<letter = a> or <letter = A>>
set number to 01
end
The next block converts letters en masse to one large string, using a variable to cycle through every letter in the string, converting it to a number, and then joining this number with the rest. Then I set the cloud variable to the output.
The third and final block joins the first two numbers of the large, text-converted number and then searches on a list for the corresponding item (1 being a, 2 being b, etc.) and joins that with the rest of the string. This can be used to read the text from the variable.
- SeptimusHeap
-
100+ posts
A Guide on Using Strings in Cloud Variables
I've had success storing usernames, if that's any indicator. Are cloud variables stored as numbers, or as strings containing digits 0-9 (and one optional decimal point)?
EDIT: I'm really asking, can cloud variables store arbitrarily long numbers, and retrieve them intact?
- Lilifant7253
-
1000+ posts
A Guide on Using Strings in Cloud Variables
You can store very Long numbers I think. I made a Project that works like a cloud list and the whole list is stored in one variable. Are cloud variables stored as numbers, or as strings containing digits 0-9 (and one optional decimal point)?
EDIT: I'm really asking, can cloud variables store arbitrarily long numbers, and retrieve them intact?
- Magnie
-
100+ posts
A Guide on Using Strings in Cloud Variables
Encode 100 usernames with the length of 5 characters and if it comes out in tact, then we are interested. 

- MathWizz
-
100+ posts
A Guide on Using Strings in Cloud Variables
I've made a cloud bitmap drawing project that uses one variable to store a number representation of the image here. The process for encoding the data is through an octree compression method, to raw bits, (1s and 0s) and then to one large number.
- Discussion Forums
- » Advanced Topics
-
» A Guide on Using Strings in Cloud Variables