I'm interested in incorporating Scratch into my classes, however, I'm running into one (big) shortcoming: I can't figure out a way to display strings.
I know you can have sprites <say[ or <think[ a string variable, but there doesn't seem to be a way to display text in that way, but without the "speaking" or "thinking" block... or am I missing something?
I don't want to just display the variable itself because that looks clunky... plus, I'd like to be able to select from a List of strings and display just one of them. Any help? Or will I just have to wait for future versions of Scratch to support this?
Offline
It's pretty hard. You have to make a sprite with numbers 1-9
Then, use this script. Replace the name of variable, with whatever the name of your variable is.:
Offline
Take a look at this project:
http://scratch.mit.edu/projects/BoltBait/1516358
It uses a list to display strings.
Offline
Yeah, the absolute best way to get something like a println function is probally just using the say or think blocks.
Scratch isn't really good for making traditional Intro to Programming Class programs. Its more for interactive programs that don't really rely on text.
You can make you own scripts to stamp each line of text out but the script which would do this would confuse new users.
Last edited by archmage (2011-01-05 16:12:56)
Offline
or just display a variable with the string as its value. But the strings would have to be pretty short. Or you could try a list.
<set{ x }to( string )>
Offline
Do you have suggestions about how you would ideally like strings displayed in Scratch 2.0? It would be great if you could add them to suggest.scratch.mit.edu
Kboof, just in case you haven't seen, if you right-click on a variable you can use "Large readout" and then it doesn't look as clunky.
Here's a shorter version of the code pika100chu suggested:
<when green flag clicked>
<forever>
<switch to costume[ <{ name of variable }>
(Note: That's in the case that [name of variable] is a number and that you've made costumes for each one you want to display.)
Offline