• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

exit the loop

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,291
hey, im making a system converted from jass or well the idea is from a system, anyway I want it to exit a loop when true but it does not seem to work.
  • For each (Integer A) from 1 to ID, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • something here
        • Then - Actions
          • Custom script: exitwhen udg_check = true
          • Set check = True
          • Game - Display to (All players) the text: true
        • Else - Actions
          • Set check = False
          • Game - Display to (All players) the text: false
EDIT; fixed
 
  • Custom script : loop
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • something here
    • Then - Actions
      • Set check = True
      • Game - Display to (All players) the text: true
    • Else - Actions
      • Set check = False
      • Game - Display to (All players) the text: false
  • Custom script : exitwhen udg_check == True
  • Custom script : endloop
I'm not 100% sure of that first solution as i'm not a Jasser x) you also have that trigger :

  • For each (Integer IntVar) from 1 to ID, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • something here
        • Then - Actions
          • Set IntVar = ID
          • Set check = True
          • Game - Display to (All players) the text: true
        • Else - Actions
          • Set check = False
          • Game - Display to (All players) the text: false
 
I don't think you need to reset "check" to false the entire time. Once before the loop is enough.
Because you set it to true after the exitwhen, it will go like this:

false
false
true (NO exitwhen, it is only set to true after the exitwhen check)
false (no exitwhen either! The variable is reset to false)
... (continue like this)

Do you want it to exit directly after the condition ("something here") is true? Then you can just do exitwhen true at the end of the Then-section and drop the "check"-variable altogether.
If you want it to exit 1 iteration after the condition is true, then remove the "Set check = false".

You can also create a loop with custom script only.
 
I converted it to jass a found a solution, thanks for the help tho, reped
  • GUI
    • For each (Integer A) from 1 to ID, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
          • Then - Actions
            • Custom script: set bj_forLoopAIndex = bj_forLoopAIndexEnd
            • Set check = True
            • Game - Display to (All players) the text: true
          • Else - Actions
            • Set check = False
            • Game - Display to (All players) the text: false
 
Last edited:
Status
Not open for further replies.
Back
Top