There is probably some huge, complicated script to do so, but I don't know it.
Even if I did know it, which I kind of do, a new scratcher might not understand it. Even I did not understand it when I saw it before.
Offline
The only way to do it is with a loop and a list, there isn't a "split (string) by (symbol)" block on scratch.
set [i] to (0) set [j] to (1) delete (all) of [list] add () to [list] repeat (length of variable) { change [i] by (1) if(letter (i) of (variable) == ) { add () to [list] change [j] by (1) } else { replace item (j) of [list] with (join ((item (j) of [list]) with (letter (i) of (variable))) } }
That should do it. It breaks up "variable" into the list based on spaces. Let me check that quick...
Edit: Debugged, should work now
Last edited by MoreGamesNow (2011-11-08 19:10:25)
Offline
Im confused about what variables and what lists to make?
Offline
so like the team names as variable?
Offline
variables "i" and "j" are just counters. You shouldn't be effecting them with other scripts. The variable called "variable" contains the string you want to split. The list "list" will contain all of the words in the variable. In other words, "variable" gets split by spaces, and the parts of variable that result are stored in "list".
Offline
set [variable] to ( Layabouts 23 Luddites 14 ) Run Code I Posted Here
The above code results in "list" being this:
1) Layabouts
2) 23
3) Luddites
4) 14
Offline
then how do i separate this list into one for a win or loss collum? or into the teams?
Offline
Compare "item (2) of [list]" and "item (4) of [list] to see who won. The one with the higher score won the game.
Offline