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

#1 2008-08-01 08:04:21

mitch4
Scratcher
Registered: 2008-03-27
Posts: 2

Output of variable value through Say or Think?

Is there a way to include the (numerical) value of a variable in a sprite's Say or Think block?

Example: An entertainment contest competitor receives scores in a 1 to 4 range from three judges.  Each judge;s score for this contestant is a variable, and the total is a variable CombinedScore.  We would like the "host" sprite to be able to Say something like "And our first contestant has received a total score of 7 points from our judges." but with the current value of CombinedScore where I wrote 7. 

We've implemented this with a horrendous set of nested if-then-else blocks, testing each possible value of the variable.  Is there a way to get the value printed out within the Say text in a more compact script?

Thanks!

==mitch

Offline

 

#2 2008-08-01 09:13:33

mitch4
Scratcher
Registered: 2008-03-27
Posts: 2

Re: Output of variable value through Say or Think?

In the posted question, I was overlooking the alternative of having a [blocks] <say[ <{ Score }> [/blocks] as a step by itself.  So there would be a previous [blocks]<say[ The contestant's score is ]for( 3 )secs> [/blocks] and then the number by itself.

It would still be nice to be able to mix. Maybe if variable-value blocks or number-calculation blocks could go into a (new) convert-to-print block of some sort, which could go into a text field like Say, right alongside or mixed with text the programmer supplies.

==mitch

Offline

 

#3 2008-08-01 13:19:58

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: Output of variable value through Say or Think?

So I see you solved it yourself. You can put in round edged blocks (like variables) in the say blocks, has well as the diamond shaped boolean ones


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

Board footer