- Joined
- Jul 17, 2006
- Messages
- 145
ok, i have a bunch of regions set up in a grid named "1 1" through "6 8" (coordinates). What i want to do is call each of these regions with a loop and variables, instead of having to copy and paste each function for each region i want to call. This proablly doesnt make much sense, so let me give you an example:
of course, i cant use a string for the name of the region, because WE wont let me do that... :S (and theres no string to region function that i know of)
anyways, i hope thats clear (if its not tell me and ill try to explain better)...anyone have any suggestions.
JASS:
// (Using Vexorians CSGame Cache system)
function Trig_Set_Square_Coordinates_Actions takes nothing returns nothing
local integer x = 1
local integer y = 1
loop
call AttachInt("gg_rct_"+I2S(x)+"_"+I2S(y), "x", x)
call AttachInt("gg_rct_"+I2S(x)+"_"+I2S(y), "y", y)
set x = x+1
if x > udg_MaxX then // udg_MaxX is the maximum X value on my grid of regions
set x = 1
set y = y+1
endif
exitwhen y > udg_MaxY // udg_MaxY is the maximum Y value on my grid of regions
endloop
endfunction
//===========================================================================
function InitTrig_Set_Square_Coordinates takes nothing returns nothing
set gg_trg_Set_Square_Coordinates = CreateTrigger( )
call TriggerAddAction( gg_trg_Set_Square_Coordinates, function Trig_Set_Square_Coordinates_Actions )
endfunction
of course, i cant use a string for the name of the region, because WE wont let me do that... :S (and theres no string to region function that i know of)
anyways, i hope thats clear (if its not tell me and ill try to explain better)...anyone have any suggestions.