- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Is there anyway to do loops with textmacros?
e.g. instead of this
do this
???
Also, is there a way I can modify the values of passed arguments? E.g. say I wanted this
but I want the function name to be "p1RegionFilter" instead of "p0RegionFilter." Can I somehow turn the "0" into an int, add 1 to it, then cast back to a string?
Finally, can I use textmacro to fill up arrays?
That way I don't need to have 12 lines of setting an array...I mean they will still be there when translated, but it looks cleaner on readability side.
Is there anyway to do loops with textmacros?
e.g. instead of this
JASS:
//! runtextmacro RegionFilter("p1", "0")
//! runtextmacro RegionFilter("p2", "1")
//! runtextmacro RegionFilter("p3", "2")
//! runtextmacro RegionFilter("p4", "3")
...
do this
JASS:
for i in range 0 to TOTAL_PLAYERS do
//! runtextmacro RegionFilter("p" + I2S(i + 1), I2S(i))
endfor
???
Also, is there a way I can modify the values of passed arguments? E.g. say I wanted this
JASS:
//! runtextmacro RegionFilter("0")
but I want the function name to be "p1RegionFilter" instead of "p0RegionFilter." Can I somehow turn the "0" into an int, add 1 to it, then cast back to a string?
Finally, can I use textmacro to fill up arrays?
JASS:
//some text macro command
loop
exitwhen i == TOTAL_FUNCTIONS
set myArray[i] = Filter($text macro function of i$)
set i = i + 1
endloop
That way I don't need to have 12 lines of setting an array...I mean they will still be there when translated, but it looks cleaner on readability side.