Minor Bug: Sometimes cannot snap "exit loop"-block

captaincomic

  • *
  • Posts: 6108
Sometimes I cannot snap the "exit loop"-block inside a loop (in this case a "for each member of <group>"-loop, I don't know if it happens with other loops as well).

See the first screenshot, it's a behavior that sends a message when all actors of a group are dead. I used a code block with
Code: [Select]
break;in there, because I couldn't put the "exit loop"-block there.

The strange thing is when I move the loop outside of the "always"-section, I can snap the "exit loop"-block. (see second screenshot) But now I am not able to move the blocks back to the "always"-section, they refuse to snap.


encore

  • Posts: 12
I've also had this issue but with if blocks. I think something about blocks with bottom edges (excluding the 'always, when this collides, when drawing and on creation' ones) are buggy.

cloa513

  • Posts: 245
From the very start of using Stencylworks, I never could get exit loops into If statements. 

Hectate

  • *
  • Posts: 4643
The IF conditional wrappers are not considered loops. They check a condition for True and then execute the contents if so. Once the contents are executed the code that takes place afterward (outside of any otherwise blocks also) is then progressed to. They do not repeat in and of themselves, and thus the "exit loop" block is not a valid place for them.

If you wish to completely stop a behavior as a result of the contents of a conditional IF check, utilize the "Stop" block instead.


In the first and last examples in the help file (see link below), the "exit loop" and "return to start of loop" blocks are inside of conditional IF wrappers, but those IF wrappers are located within the looping While wrappers themselves - which is what allows them to be placed there.

http://static.stencyl.com/swHelp/en/html/main/blocks/flow/flow_looping/Stopping.html

:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Alexin

  • *
  • Posts: 3127
Actually, the use case presented by Captain is legitimate and the blocks should snap.
Note the intention is to exit the inner loop, not "always".
"Find the fun"
alexin@stencyl.com

Hectate

  • *
  • Posts: 4643
So you're saying these should work with the "for each actor of type" rather than only the other loops?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Jon

  • *
  • Posts: 17524
It's possible that the "exit loop" block is only wired to work with the literal for/while loops and never got programmed to recognize the other "for" loops.

captaincomic

  • *
  • Posts: 6108
I checked again: only the "for each member of group"-block seems to have this problem.
The "for each actor of type"-block works with "exit loop".

Jon

  • *
  • Posts: 17524
Thanks for checking on this. This should be straightforward to fix.

captaincomic

  • *
  • Posts: 6108
Fixed in 2015, haha (b8782). It wasn't actually straightforward, but Justin has rewritten the block context detection.