{"name":"BIS_fnc_keyHold","operator":null,"title":"BIS fnc keyHold","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_keyHold","revid":341362,"updated":"2023-05-24T12:59:06Z","groups":["Interaction"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.00"}],"since":{"game":"arma3","name":"Arma 3","version":"1.00"},"arma3_since":"1.00","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":"spawn","description":"Allows for hold button interactions. Hold action is started by pressing <kbd>Space</kbd>.","syntaxes":[{"syntax":"[description, duration, condition, arguments, loaded] spawn BIS_fnc_keyHold","since":null,"effect":null,"exec":null,"params":[{"name":"description","type":"String","optional":false,"default":null,"description":"description of the performed action, displayed inside the progress bar.","types":["String"],"since":null,"text":"description: String - description of the performed action, displayed inside the progress bar."},{"name":"duration","type":"Number","optional":true,"default":"2","description":"action duration","types":["Number"],"since":null,"text":"duration: Number - (Optional, default 2) action duration"},{"name":"condition","type":"Code or String","optional":true,"default":"`{ true }`","description":"condition that must be met for the action to display","types":["Code","String"],"since":null,"text":"condition: Code or String - (Optional, default `{ true }`) condition that must be met for the action to display"},{"name":"arguments","type":"Array","optional":true,"default":"`[]`","description":"arguments passed to the condition","types":["Array"],"since":null,"text":"arguments: Array - (Optional, default `[]`) arguments passed to the condition"},{"name":"loaded","type":"Boolean","optional":true,"default":"false","description":"defines if function is already loaded. This is handled by the function","types":["Boolean"],"since":null,"text":"loaded: Boolean - (Optional, default false) defines if function is already loaded. This is handled by the function"}],"returns":{"type":"- spawn: Script Handle","types":["spawn","Script Handle"],"description":"call: true if action was successful or false if it was interrupted.","text":"- spawn: Script Handle\n- call: true if action was successful or false if it was interrupted."}}],"examples":[{"text":"```sqf\n[\"Hold that key!\", 2, { alive player }] spawn BIS_fnc_keyHold;\n```","code":["[\"Hold that key!\", 2, { alive player }] spawn BIS_fnc_keyHold;"]},{"text":"Function can be called in scheduled environment to return values and be used for further code execution.\n\n```sqf\n0 spawn {\n    private _success = [\"Hold that key!\", 2, { alive player }] call BIS_fnc_keyHold;\n    if (_success) then { hint \"Function executed\" } else { hint \"Function interrupted\" };\n};\n```","code":["0 spawn {\n\tprivate _success = [\"Hold that key!\", 2, { alive player }] call BIS_fnc_keyHold;\n\tif (_success) then { hint \"Function executed\" } else { hint \"Function interrupted\" };\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_holdActionAdd","BIS_fnc_holdKey"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Interaction","Functions","Functions: Local Effect","Introduced with Arma 3 version 1.00"],"docblock":null,"filled_from_docblock":[]}