This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-05 15:28:18

kboof
New Scratcher
Registered: 2011-01-05
Posts: 3

Displaying strings

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

 

#2 2011-01-05 15:41:19

pika100chu
Scratcher
Registered: 2009-07-26
Posts: 500+

Re: Displaying strings

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.:
http://i607.photobucket.com/albums/tt156/pika10/gif.gif

Offline

 

#3 2011-01-05 15:59:35

kboof
New Scratcher
Registered: 2011-01-05
Posts: 3

Re: Displaying strings

Hmm... yeah, that isn't pretty code, but it might be acceptable for the classroom if I develop the sprite with each costume and provide it to the students.

Thanks!

Offline

 

#4 2011-01-05 16:01:40

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Displaying strings

Take a look at this project:

http://scratch.mit.edu/projects/BoltBait/1516358

It uses a list to display strings.


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#5 2011-01-05 16:10:55

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Displaying strings

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)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#6 2011-01-05 16:43:23

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Displaying strings

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 )>


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#7 2011-01-06 07:09:37

natalie
Scratch Team
Registered: 2007-03-07
Posts: 100+

Re: Displaying strings

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

 

Board footer