- Joined
- Aug 2, 2006
- Messages
- 346
I have an array of booleans to correspond to a button being down (true), or up (false) for each player.
To setup this trigger, is it better to do it this way:
or this way:
Part of me thinks that it's just not right to have a loop in the events... but I barely understand how events work in JASS anyways so... that's why I'm here.
To setup this trigger, is it better to do it this way:
Code:
function InitTrig_UpArrowDepress takes nothing returns nothing
set gg_trg_UpArrowDepress = CreateTrigger( )
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(0), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(1), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(2), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(3), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(4), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(5), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(6), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(7), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(8), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(9), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(10), EVENT_PLAYER_ARROW_UP_UP)
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress, Player(11), EVENT_PLAYER_ARROW_UP_UP)
call TriggerAddAction( gg_trg_UpArrowDepress, function Trig_UpArrowDepress_Actions )
endfunction
Code:
function InitTrig_UpArrowDepress_Copy takes nothing returns nothing
local integer i = 0
set gg_trg_UpArrowDepress_Copy = CreateTrigger( )
loop
exitwhen i >= 12
call TriggerRegisterPlayerEvent(gg_trg_UpArrowDepress_Copy, Player(i), EVENT_PLAYER_ARROW_UP_UP)
set i = i + 1
endloop
call TriggerAddAction( gg_trg_UpArrowDepress_Copy, function Trig_UpArrowDepress_Actions )
endfunction
Part of me thinks that it's just not right to have a loop in the events... but I barely understand how events work in JASS anyways so... that's why I'm here.
Last edited: