Here's an example. Let's say I have an animation for a sprite that goes:
(switch to costume 1)
(wait .1 seconds)
(switch to costume 2)
(wait .1 seconds)
(switch to costume 3)
(wait .1 seconds)
And so on. But if at any point in this script, should I press X, I want it to stop. What I could do is something like this:
_IF (not) x key pressed
(switch to costume 1)
(wait .1 seconds)
_IF (not) x key pressed
(switch to costume 2)
(wait .1 seconds)
_IF (not) x key pressed
(switch to costume 3)
(wait .1 seconds)
_IF (not) x key pressed
(switch to costume 4)
(wait .1 seconds)
But that takes forever and isn't very efficient. What I'm asking for is a better way to do this. Like maybe I could make a block that covers the whole script and says (if X key pressed, break), or something like that.
Snap! can switch to another script only at certain point (wait, end of the loop, for each...)
So you must use some kind of the wait - You may use wait 0.1 / break on condition.
Do you need explanation of the wait/break internals?
It replaces a single wait instruction with the serie of shorter wait to stop early if condition is true (call condition)
stopthis script ???
It breaks the whole script/process up to green flag or when receive.
I'm not a native speaker, and maybe it's not clear enough; sorry.