{"name":"BIS_fnc_holdKey","operator":null,"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","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.78"}],"since":{"game":"arma3","name":"Arma 3","version":"1.78"},"arma3_since":"1.78","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"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.\n\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","since":null,"effect":null,"exec":null,"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","types":["Display"],"since":null,"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 <kbd>Space</kbd>","description":"what key to press - see DIK KeyCodes","types":["Number"],"since":null,"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","types":["Number"],"since":null,"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","types":["Code"],"since":null,"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.","types":["Control"],"since":null,"text":"control: Control - (Optional, default controlNull) text control to be used in place of the default \"Press X to skip\" control."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[findDisplay 46, 36, 5, { hint \"Key 'J' pressed for 5 seconds\" }] spawn BIS_fnc_holdKey; // action is added to the mission display\n```","code":["[findDisplay 46, 36, 5, { hint \"Key 'J' pressed for 5 seconds\" }] spawn BIS_fnc_holdKey; // action is added to the mission display"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_holdActionAdd","addAction","BIS_fnc_keyHold"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Interaction","Functions","Introduced with Arma 3 version 1.78"],"docblock":null,"filled_from_docblock":[]}