Wait with messages
Posted: Fri Mar 12, 2010 9:14 pm
Hi,
I have the following code associated with an icon. When the user hits the icon it disappears, randomly sets a new location and then shows itself. This happens while a countdown from 30 seconds to 0 occurs. When i don't have a 'wait' command it works fine. However, with the wait command inserted the timer stops counting down every time the icon is hit. I thought 'wait with messages' meant that other running scripts (i.e. the countdown) continued in the background? Or does that only work with a 'repeat'?
I have the following code associated with an icon. When the user hits the icon it disappears, randomly sets a new location and then shows itself. This happens while a countdown from 30 seconds to 0 occurs. When i don't have a 'wait' command it works fine. However, with the wait command inserted the timer stops counting down every time the icon is hit. I thought 'wait with messages' meant that other running scripts (i.e. the countdown) continued in the background? Or does that only work with a 'repeat'?
Code: Select all
global tScore, txLoc, tyLoc
on mousedown
add 1 to tScore
put tScore into field "scoreField"
hide me
put random(240) into txLoc
put txLoc + 40 into txLoc
put random(320) into tyLoc
put tyLoc + 40 into tyLoc
set the loc of me to txLoc,tyLoc
wait 2 seconds with messages
show me
end mousedown