BIS fnc keyHold: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]+)<\/code>" to "<sqf>$1</sqf>")
(As this function does return bool value when called, added info to r1 + x2 with call inside spawn)
Line 22: Line 22:
|p5= loaded: [[Boolean]] - (Optional, default [[false]]) Defines if function is already loaded. This is handled by the function
|p5= loaded: [[Boolean]] - (Optional, default [[false]]) Defines if function is already loaded. This is handled by the function


|r1= [[Nothing]]
|r1= [[Nothing]] when [[spawn]]ed. If [[call]]ed, will return [[true]] if action was successful or [[false]] if it was interrupted.


|x1= <sqf>["Hold that key!",2,{alive player}] spawn BIS_fnc_keyHold;</sqf>
|x1= <sqf>["Hold that key!",2,{alive player}] spawn BIS_fnc_keyHold;</sqf>
|x2= Function can be called in [[Scheduler#Scheduled_Environment|scheduled environment]] to return values and be used for further code execution.<br /><sqf>[] spawn {
private _success = ["Hold that key!", 2, {alive player}] call BIS_fnc_keyHold;
if (_success) then {hint "Function executed"} else {hint "Function interrupted"};
}</sqf>


|exec= spawn
|exec= spawn


|seealso= [[BIS_fnc_holdActionAdd]]
|seealso= [[BIS_fnc_holdActionAdd]] [[BIS_fnc_holdKey]]
}}
}}

Revision as of 14:32, 24 May 2023

Hover & click on the images for description

Description

Description:
Allows for hold button interactions. Hold action is started by pressing the space bar.
Execution:
spawn
Groups:
Interaction

Syntax

Syntax:
[description, duration, condition, arguments, loaded] spawn BIS_fnc_keyHold
Parameters:
description: String - Description of the performed action, displayed inside the progress bar.
duration: Number - (Optional, default 2) Duration of the action
condition: Code or String - (Optional, default {true}) Condition that must be met for the action to display
arguments: Array - (Optional, default []) Arguments passed to the condition
loaded: Boolean - (Optional, default false) Defines if function is already loaded. This is handled by the function
Return Value:
Nothing when spawned. If called, will return true if action was successful or false if it was interrupted.

Examples

Example 1:
["Hold that key!",2,{alive player}] spawn BIS_fnc_keyHold;
Example 2:
Function can be called in scheduled environment to return values and be used for further code execution.
[] spawn { private _success = ["Hold that key!", 2, {alive player}] call BIS_fnc_keyHold; if (_success) then {hint "Function executed"} else {hint "Function interrupted"}; }

Additional Information

See also:
BIS_fnc_holdActionAdd BIS_fnc_holdKey

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note