• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Skip Remaining Actions. Does it count?

Status
Not open for further replies.
Level 6
Joined
Sep 11, 2006
Messages
172
Quick question. In the GUI, does Skip Remaining Actions function as an effective exit loop when placed within an integer loop that has a condition within it?

Example:

  • Special Light Room
    • Events
    • Conditions
    • Actions
      • Destructible - Pick every destructible in RegOp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Destructible-type of (Picked destructible)) Equal to |cffff8c00Power Console|r
            • Then - Actions
              • For each (Integer Index[2]) from 1 to 352, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked destructible) Equal to PowerConsole[Index[2]]
                    • Then - Actions
                      • -------- Make Visible/Buildable --------
                      • Visibility - Enable LightMask[Index[2]]
                      • Visibility - Disable DarkMask[Index[2]]
                      • Set Switch = 1
                      • Trigger - Run Power and Lighting On <gen> (ignoring conditions)
                      • Destructible - Remove (Picked destructible)
                      • -------- Run Waves --------
                      • Trigger - Run Turn Wave <gen> (checking conditions)
                      • Trigger - Run Income <gen> (checking conditions)
                      • Skip remaining actions
                    • Else - Actions
            • Else - Actions
 
Level 15
Joined
Sep 29, 2008
Messages
362
skip remaining actions means return from executing function.
this work if the loop-inside code is called from another function.
If you call skip remaining function from a loop inside of a trigger actions it will ends the trigger function instead of the loop. The way to exit from a loop is doing boolean evaluations. So, if you want to skip some actions into your loop, use if-then to change boolean condition.
for example
  • test
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait for (Last played sound) to be 0.00 seconds from finished playing
          • Skip remaining actions
the boolean evaluation of this line: "For each (Integer A) from 1 to 10, do (Actions)" is Integer A>10 equals to true
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
If you want to exit out of a For each (Integer) loop, you can use exitwhen true.

Comparing units:
  • Set Unit = (Random unit)
  • For each (Integer LoopInt) from 1 MaxIndex, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Unit Equal to UnitArray[LoopInt]
        • Then - Actions
          • -------- Found unit! Exit loop --------
          • Custom script: exitwhen true
        • Else - Actions
          • -------- unit was not found; continue searching --------
 
Status
Not open for further replies.
Top