Hi, I'd like to know how to put each letter of a variable into separate items on a list. Like, to take "John" and turn it into "J, o, h, n", so that I can make acronyms for anything in my new project that I am working on.
Offline
Yeah, Harakou script is nice and simple and effective. Many programming languages come with a function/method that does that, but Scratch doesn't have one that is pre-made, so you have to do it manually.
Alternatively, instead of using a repeat until loop, use a repeat for loop, and put the length of the variable in there. The rest of the script would be the same. This is just a tad simpler.
<When Green Flag Pressed> <set{ i }to( 0 )> <Repeat ( length of variable )> <change{ i }by( 1 )> add (letter(i) of (variable)) to [list]> <end>
Last edited by MoreGamesNow (2011-06-05 21:43:46)
Offline
I can't see that image (k9 web security blocks it, for "open image/media search"), but thanks, Both will work.
Offline