• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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 16
Joined
Sep 29, 2008
Messages
366
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
 
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