Sry for double post but i just run in to a little problem! well i like defines coz tehy are inlined but problem is:
define RegisterEvent (trig, event_id) = {
integer i = 0
loop
exitwhen (i >= bj_MAX_PLAYER_SLOTS)
call TriggerRegisterPlayerUnitEvent(trig, Player(i), event_id, null)
set i++
endloop
}
function some void
trigger t = CreateTrigger()
TriggerAddAction(t, function some2)
RegisterEvent(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
endfunction
should be:
function some void
trigger t = CreateTrigger()
integer cj_RegisterEvent__i = 0 // MOVED!!!
TriggerAddAction(t, function some2)
loop
exitwhen (cj_RegisterEvent__i >= bj_MAX_PLAYER_SLOTS)
call TriggerRegisterPlayerUnitEvent(t, Player(cj_RegisterEvent__i), event_id, null)
set cj_RegisterEventi = cj_RegisterEventi + 1
endloop
endfunction
so like in c++ u can declare locals anywhere and if they are in define then they must be renamed...
you can ofc choose syntax, so it can be something like this!
function some void
integer i = 0
call DoNothing()
auto integer j = 0
endfunction
auto will move it at top of the function, so u dont need to detect but user must say it ;)
Best Regards!
~Dark Dragon