Topic Information

SEPARATE ONE VARIABLE INTO DIFFERENT ITEMS ON A LIST by sniperghost1 in Help With Scripts

Posts: 5

1: sniperghost1 wrote at 3:10:31 PM 15/5/20204016050
so i have a variable and it is encoded. its encoded like this “11 66 7 22 69 48 2 1”. basically, either two digit or one digit numbers separated by a space, all in one variable. how could i move each group of numbers out of the variable into separate items on a list? any tips help, and thx in advance.
2: Monna-Uka wrote at 3:45:41 PM 15/5/20204016221
You can check Griffpatch's multiplayer game tutorial. A similiar thing is introduced in episode 2, which uses ‘00’ as the space symbol.
3: Oumuamua wrote at 3:58:29 PM 15/5/20204016262
Basically, you must go thorugh the string checking if every single char is a space, if not then add a new item with the number and join with next numbers until a new space is found.
I have this https://scratch.mit.edu/projects/370010508/ that works even with bad formatted strings(remove all occurrences of a given separator)
4: deck26 wrote at 4:24:21 PM 15/5/20204016361
Much easier though to add leading zeroes so all the values were two-digit to start with and you didn't bother with spaces to separate since there is then no need.
5: sniperghost1 wrote at 5:28:53 PM 15/5/20204016709
thank guys for the help! i figured out how to do it, i used the suggestion about going through the string which worked, and worked efficiently