Hi,
I'm having trouble with the "Stop all" control. I would expect it to instantly stop all scripts from running. But I'm experiencing that, for example, it allows a forever-loop to complete its current iteration before it stops.
In the first block below, the sprite will move up until it touches the top edge. However, just after it stops (after a short delay), it makes one more move. To me it seems like it completes the current "forever" iteration, before it finally stops.
In the second block, I've used an "if-else" instead of only "if". This makes the sprite stop instantly when touching the edge, as expected. This is because the "change y by 5" is not run within the same iteration (because it depends of the "else" condition), I suppose.
Is this "correct behaviour", or is it something I oversee in the first example?
when gf clicked forever if <touching [edge v]?> stop all end change y by (5) end
when gf clicked forever if <touching [edge v]?> stop all else change y by (5) end end
Offline
BarryBurk wrote:
Hi,
I'm having trouble with the "Stop all" control. I would expect it to instantly stop all scripts from running. But I'm experiencing that, for example, it allows a forever-loop to complete its current iteration before it stops.
In the first block below, the sprite will move up until it touches the top edge. However, just after it stops (after a short delay), it makes one more move. To me it seems like it completes the current "forever" iteration, before it finally stops.
In the second block, I've used an "if-else" instead of only "if". This makes the sprite stop instantly when touching the edge, as expected. This is because the "change y by 5" is not run within the same iteration (because it depends of the "else" condition), I suppose.
Is this "correct behaviour", or is it something I oversee in the first example?when gf clicked forever if <touching [edge v]?> stop all end change y by (5)when gf clicked forever if <touching [edge v]?> stop all else change y by (5) end
Hmmm... strange. I would've expected otherwise...
Anyway, out of curiosity, do you have any other scripts in your sprite?
With regards,
ErnieParke
Last edited by ErnieParke (2013-04-11 20:52:56)
Offline
ErnieParke wrote:
Hmmm... strange. I would've expected otherwise...
Anyway, out of curiosity, do you have any other scripts in your sprite?
With regards,
ErnieParke
Nope, it happens for me too. I think it's a bug.
Offline
Hyperbola wrote:
ErnieParke wrote:
Hmmm... strange. I would've expected otherwise...
Anyway, out of curiosity, do you have any other scripts in your sprite?
With regards,
ErnieParkeNope, it happens for me too. I think it's a bug.
I actually just tested this and I got the same results as you. Well, now that I think of it, it doesn't seem too out of place, though it's a "bug" none the less.
To BarryBurk:
This isn't anything that you're overseeing, though it's not necessarily "correct behavior" either. I'd love to do some more testing on this to find out Scratch's response to issues like this before I can get you more information.
Okay, so I had just conducted some tests. I still haven't found out much, though I did notice that you could always change your upper script into this to remove the "glitch":
when gf clicked forever change y by (5) if (touching [edge v]?) stop all end
Last edited by ErnieParke (2013-04-11 21:02:39)
Offline
I just figured a bit more about the [Stop All] block. Apparently, it doesn't stop everything but actually does it when it runs into a delay of some sort, which in your case, is the end of the forever loop. I'm not sure how this would connect with several other scripts, though at least we know a bit more.
With regards,
ErnieParke
Offline