{"name":"BIS_fnc_holdKey","title":"BIS fnc holdKey","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_holdKey","revid":341505,"updated":"2023-06-05T20:02:15Z","groups":["Interaction"],"status":"ok","games":{"arma3":"1.78"},"since":"arma3 1.78","arma3_since":"1.78","exec":"spawn","description":"Function that executes code when a key has been held down for a long enough time - \"Hold X to Advance\" text is displayed when any key is pressed.\nAll other keys (but <kbd>Esc</kbd>) are deactivated until the conditions are met - only mouse controls work (character rotation and fire).","syntaxes":[{"syntax":"[display, key, time, code, control] call BIS_fnc_holdKey","params":[{"name":"display","type":"Display","optional":true,"default":"`findDisplay 12` for map display","description":"display the event is attached to. By default it is the map display","type_expr":"Display","text":"display: Display - (Optional, default `findDisplay 12` for map display) display the event is attached to. By default it is the map display"},{"name":"key","type":"Number","optional":true,"default":"57 for Space","description":"what key to press - see DIK KeyCodes","type_expr":"Number","text":"key: Number - (Optional, default 57 for <kbd>Space</kbd>) what key to press - see DIK KeyCodes"},{"name":"time","type":"Number","optional":true,"default":"3","description":"how long the key has to be held down in seconds","type_expr":"Number","text":"time: Number - (Optional, default 3) how long the key has to be held down in seconds"},{"name":"code","type":"Code","optional":true,"default":"`{}`","description":"scheduled code to be executed when key is held down for long enough","type_expr":"Code","text":"code: Code - (Optional, default `{}`) scheduled code to be executed when key is held down for long enough"},{"name":"control","type":"Control","optional":true,"default":"controlNull","description":"text control to be used in place of the default \"Press X to skip\" control.","type_expr":"Control","text":"control: Control - (Optional, default controlNull) text control to be used in place of the default \"Press X to skip\" control."}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[findDisplay 46, 36, 5, { hint \"Key 'J' pressed for 5 seconds\" }] spawn BIS_fnc_holdKey; // action is added to the mission display"]}],"see_also":["BIS_fnc_holdActionAdd","addAction","BIS_fnc_keyHold"]}