Arkan
Nobody rides for free
- Reaction score
- 92
Example trigger:
GUI using a global variable:
Now I want to make the same thing in JASS using a local variable to make trigger MUI. So I convert the trigger to custom text and this si what I get:
Now as I've understood local variables can only be used within ONE single function, so how would I make wait for conditon work if I don't want to use a global variable?
Sorry I don't think I can explain any better than this :/
GUI using a global variable:
Code:
Events: -
Condtions: -
Actions:
For each (Integer B) from 1 to 5, do (Actions)
Loop - Actions
Set i = (i + 1)
Wait until (i Equal to 5), checking every 0.20 seconds
Now I want to make the same thing in JASS using a local variable to make trigger MUI. So I convert the trigger to custom text and this si what I get:
Code:
function Trig_GUI_Func002001 takes nothing returns boolean
return ( [B]udg_i[/B] == 5 )
endfunction
function Trig_GUI_Actions takes nothing returns nothing
set bj_forLoopBIndex = 1
set bj_forLoopBIndexEnd = 5
loop
exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd
set [B]udg_i [/B] = ( [B]udg_i[/B] + 1 )
set bj_forLoopBIndex = bj_forLoopBIndex + 1
endloop
loop
exitwhen ( Trig_GUI_Func002001() )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.20))
endloop
endfunction
//===========================================================================
function InitTrig_GUI takes nothing returns nothing
set gg_trg_GUI = CreateTrigger( )
call TriggerAddAction( gg_trg_GUI, function Trig_GUI_Actions )
endfunction
Now as I've understood local variables can only be used within ONE single function, so how would I make wait for conditon work if I don't want to use a global variable?
Sorry I don't think I can explain any better than this :/