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

#1 2013-02-04 14:04:06

heart016
New Scratcher
Registered: 2013-02-04
Posts: 2

Sprite saying the value of a variable

Hi! I'm working on a vending machine game for school. One requirment is that as the user puts the coins in, the cotrolling sprite is supposed to say the new balance of the money in the screen. I have a variable called "money" that changes as more money is put into the machine. Right now what I have isn't working, I can't put a dollar sign in front of the value or "dollar" or something after it. This is what I have right now.

When I recieve [Balance v] //Should be a hat block, don't know how to fix
say (money) for [1] secs
I tried putting a "say: your balance is" block before my sprite says the variable, or putting a "say: dollars" block after my sprite says the balance, but that just looks clunky and doesn't work. Any ideas???
Thanks,
heart016

Offline

 

#2 2013-02-04 14:13:07

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Sprite saying the value of a variable

There is a join block in operators.
try (I can't remember the scratchblocks code)
say (join $ balance) for 1 secs

Offline

 

#3 2013-02-04 19:28:27

heart016
New Scratcher
Registered: 2013-02-04
Posts: 2

Re: Sprite saying the value of a variable

Yeah!!!! It works, thanks!

Offline

 

Board footer