I need to be able to make a sprite do something if a variable is changed to anything other than what it was before it was changed. Is it possible?
Offline
Well, you would need two variables: the one you're using, and the past one. Have a script like this:
[blocks]
<when green flag clicked>
<forever>
<set{ pastvar }to( var
<wait( 1 )secsc>
[/blocks]
Then, if pastvar is not equal to var, do what you want. The wait can be changed to anything above 0.
Offline
Or if you want it instantaneous, do this:
Put the scripts you want to be run into the empty "if" block.
Offline
Kileymeister wrote:
Or if you want it instantaneous, do this:
http://i53.tinypic.com/2hicqpw.gif
Put the scripts you want to be run into the empty "if" block.
Great idea! Even better is if you put the
[set |old variable| to (variable)]
block at the top of the loop, so you don't have to put it 2 times, once in the loop and once before it.
Offline
scratchisthebest wrote:
Great idea! Even better is if you put the
[set |old variable| to (variable)]
block at the top of the loop, so you don't have to put it 2 times, once in the loop and once before it.
since each script runs in one frame, if u put it at the top, it wont work because it's always equal
Offline