• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Custom Script Integer A

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
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
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
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