TriggerRegisterPlayerKeyEventBJ
- Parameters
-
trig trigger
whichPlayer player
keType integer
keKey integer
- comment
- patch
1.07
- Source
- Blizzard.j
- return type
event
- Source code
function TriggerRegisterPlayerKeyEventBJ takes trigger trig, player whichPlayer, integer keType, integer keKey returns event if (keType == bj_KEYEVENTTYPE_DEPRESS) then // Depress event - find out what key if (keKey == bj_KEYEVENTKEY_LEFT) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_LEFT_DOWN) elseif (keKey == bj_KEYEVENTKEY_RIGHT) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_RIGHT_DOWN) elseif (keKey == bj_KEYEVENTKEY_DOWN) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_DOWN_DOWN) elseif (keKey == bj_KEYEVENTKEY_UP) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_UP_DOWN) else // Unrecognized key - ignore the request and return failure. return null endif elseif (keType == bj_KEYEVENTTYPE_RELEASE) then // Release event - find out what key if (keKey == bj_KEYEVENTKEY_LEFT) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_LEFT_UP) elseif (keKey == bj_KEYEVENTKEY_RIGHT) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_RIGHT_UP) elseif (keKey == bj_KEYEVENTKEY_DOWN) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_DOWN_UP) elseif (keKey == bj_KEYEVENTKEY_UP) then return TriggerRegisterPlayerEvent(trig, whichPlayer, EVENT_PLAYER_ARROW_UP_UP) else // Unrecognized key - ignore the request and return failure. return null endif else // Unrecognized type - ignore the request and return failure. return null endif endfunction