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

#1 2012-03-20 16:10:58

TheSpitster
Scratcher
Registered: 2011-05-13
Posts: 33

Variables

Ok, i have a variable for ammo in a project im working on but when i tell the script to change ammo by -1 it does it but does not change the number on the readout and it's really important that it shows the number. Why is this.


The only thing worse than watching jaws on the way to the beach is watching chuck norris on your way to texas

Offline

 

#2 2012-03-20 16:20:48

TheSpitster
Scratcher
Registered: 2011-05-13
Posts: 33

Re: Variables

when gf clicked
forever if <key [space v] pressed?>
  change [ammo: V] by (-1)
end
when gf clicked
forever if <(ammo:) = (0)>
  broadcast [reload v]
end
I did something like this

Note that id did reload, but the ammo readout didn't change


The only thing worse than watching jaws on the way to the beach is watching chuck norris on your way to texas

Offline

 

#3 2012-03-20 16:55:49

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

Re: Variables

If the display isn't changing, your script is probably incorrect (looks fine to me though  hmm ).  It is possible that you deleted "ammo:" and then created the variable again.  If that's the case, to fix it you'll have to go through all your blocks that reference "ammo:" and replace them with new blocks.


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

Offline

 

#4 2012-03-20 16:56:52

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

Re: Variables

Your project "World War Boot Camp" appears to be working fine, is it a different one?


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

Offline

 

#5 2012-03-21 14:18:55

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Variables

MoreGamesNow wrote:

If the display isn't changing, your script is probably incorrect (looks fine to me though  hmm ).  It is possible that you deleted "ammo:" and then created the variable again.  If that's the case, to fix it you'll have to go through all your blocks that reference "ammo:" and replace them with new blocks.

No, Scratch remembers a deleted variable's name, so you can restore them without changing any of the blocks.

Last edited by rdococ (2012-03-21 14:19:22)

Offline

 

Board footer