Why isn't the local variable resetting in this case?

0 favourites
  • 1 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Is there reason why Local_Loop_Done doesn't reset on each loop in this context?

    I thought that local variables are supposed to reset on every loop unless they're set to "Static", but in this case the local variable never seems to reset?

    In the documentation it says:

    By default, local variables reset to their initial value whenever entering their scope (usually every tick)

    Which to me sounds like it's supposed to reset the variable whenever whenever the root condition that evaluates "Script_Block_Is_Busy" and "Script_Keep_Looping" returns true.

    However instead, the variable never seems to reset as long as these root-level bools return true.

    Why is that?

    EDIT:

    I figured it out. I was expecting the variable to reset on every "For each"-loop, thinking that every such loop would count as "entering the scope" of the root event outside of the "For each"-loop.

    However, local variables won't reset inside a "For each"-loop if it was defined outside of the loop. This means that it'll only reset during ticks that take place outside of the "For each"-loop.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)