HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Loop Until?

09-17-2005, 06:01 PM#1
PCPharaoh
Is there a way to make a loop that repeats until a condition is true?
09-17-2005, 06:13 PM#2
shadow1500
use jass

Quote:
loop
exitwhen <condition goes here>
//do some actions
endloop
09-20-2005, 08:37 PM#3
Gandalf2349
to incorperate this into GUI do this:

Quote:
Trigger
-Events
-Conditions
-Actions
--Custom Script: loop
--Custom Script: exetwhen <condition function set in map init.>
--... <GUI ACTIONS> ...
--Custom Script: endloop

If you don't know how to make a condition function, just make a new trigger, add your condition into the conditions value and convert it to custom script. At the top of the Trigger you should see function Untitled0001_Conditions or something or other. Copy that until the first endfunction and paste it into the mapfile at the top of the trigger treeview. Then copy the name of that trigger, the text between funtion and takes and then post that as your conditon. Make sure you add () to the end of it.
09-21-2005, 11:29 PM#4
Vexorian
also:

[quote]
Trigger Loop
Events: none
Conditions:
(condition is not true)
Actions
(--- do stuff ---)
(Trigger - Run (this trigger))

Trigger Caller
Events: (whatever)
Conditions: (whatever)
Actions
(whatever)
(Trigger - Run (loop <gen>))

09-22-2005, 12:40 AM#5
PCPharaoh
Very awesome! Thanks everyone.
09-24-2005, 01:45 PM#6
MrApples
I tried this for setting a custom value for each unit, that it would loop until there are no more units left to set.

But it caused a crash, it seems infinite loops and what seems to look like infinite loops all crash,. the trigger was supposed to run about 30 times.
10-07-2005, 11:27 AM#7
divine_peon
use the unit group trigger instead