Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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!
That action will run everything inside it 10 times, this is called a loop.
For each(Integer A) from 1 to 10, do (Actions)
You can modify this loop by changing number 1 and 10. At this case number 1 is the start number for the loop and number 10 is the end number. So this loop will loop through itself 10 times.
If you change it to:
For each(Integer A) from 1 to 100, do (Actions)
it will loop 100 times.
And this loop:
For each(Integer A) from 6 to 20, do (Actions)
will loop 15 times
Example:
This trigger below here will print out the text "Hello World!" five times at the screen, but with a loop you can do it A LOT simpler!
Loop Test
Events
Conditions
Actions
Game - Display to (All players) the text: Hello World!
Game - Display to (All players) the text: Hello World!
Game - Display to (All players) the text: Hello World!
Game - Display to (All players) the text: Hello World!
Game - Display to (All players) the text: Hello World!
The same trigger above but with a loop:
Loop Test
Events
Conditions
Actions
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Game - Display to (All players) the text: Hello World!
Do you get it? You can play around a lot with loops, this is just basics.
Well Dr Super Good, there aren't many triggerers that needs a loop that does things 9999999999999999999999999999999999999999999999999999999999999999 times instead of 9999999.
tjordell, what you said was rather pointless. Firstly WC3 can not handle that left number cause it is greater than an signed integer of size 32 bits. Secondly a loop with fewer itterations than that you mentioned would easilly hit the op limit and thus cause a "thread crash" which basically means code will stop executing once the limit is reached.
exitwhen true
Can be used as a hard coded break out of a loop. This is not that often used cause you can just place the conditional code after the loop but in some cases could be useful.
exitwhen u = null
Is used for an unefficent enum. Basically where you loop through a group of units by getting the first unit and removing that from the group repetitivly. Works with forces as well but generally its better to enum through the group/force (faster).
You can even have more complex conditions and still be valid but in the end it is entrily up to what you need.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.