• 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.

Custom Script Integer A

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
There is no such command.

Instead you loop until a condition is met.

JASS:
loop
    exitwhen boolean
endloop

You can have as many exitwhen clauses as you want (even none at all for an infinite loop but that will hit the op limit in most cases crashing the thread).

For a loop between 0 and 9 (inclusive) you can do...

JASS:
local integer i = 0
loop
    exitwhen i >= 10
    //code to run goes here
    set i = i + 1
endloop
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
I need it in custom script. It was something like GET_LOOP_INDEX_A or what. Example:

  • For Integer A 0 to 4 loop
    • call RemoveLocation(udg_RemLoc[GET_LOOP_INDEX_A(or what)])
I know it exists because I used it so many times.

I will just add one thing: If you were looking for how Integer A is represented in Jass its: GetForLoopIndexA().

ah thx
 
even none at all for an infinite loop but that will hit the op limit in most cases crashing the thread

I'm sure nobody will do that :)...


Additional to DSG's answer...

Muti-loops;

I use this system for multiboard initialization...
JASS:
local integer i = 0
loop
    exitwhen i >= 10
    //code to run goes here
    set i = i + 1
endloop

set i = 2
loop
    exitwhen i >= 20
    //code to run goes here
    set i = i + 2
endloop

set i = 1
loop
    exitwhen i >= 15
    //code to run goes here
    set i = i + 1
endloop

//AND SO ON...
 
Status
Not open for further replies.
Top