BIS fnc keyHold: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
m (Some wiki formatting)
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.00


|1.00|Game version=
|gr1= Interaction


<!---|arg= local |Multiplayer Arguments=--->
|eff= local


<!---|eff= local |Multiplayer Effects=--->
|descr= Allows for hold button interactions. Hold action is started by pressing {{Controls|Space}}.


| <pre>/*
|s1= [description, duration, condition, arguments, loaded] spawn [[BIS_fnc_keyHold]]
Author: Thomas Ryan


Description:
|p1= description: [[String]] - description of the performed action, displayed inside the progress bar.
Allow for hold button interactions.


Parameters:
|p2= duration: [[Number]] - (Optional, default 2) action duration
_this select 0 (Optional): STRING - Description of the performed action, displayed inside the progress bar.
_this select 1 (Optional): NUMBER - Duration of the action. (Default: 2 seconds)
_this select 2 (Optional): STRING or CODE - Condition that must be met for the action to display.
_this select 3 (Optional): ARRAY - Arguments passed to the code executed.


Returns:
|p3= condition: [[Code]] or [[String]] - (Optional, default <sqf inline>{ true }</sqf>) condition that must be met for the action to display
True if the action was successful, false if it was interrupted.
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_keyHold]]|Syntax=
|p4= arguments: [[Array]] - (Optional, default <sqf inline>[]</sqf>) arguments passed to the condition


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|p5= loaded: [[Boolean]] - (Optional, default [[false]]) defines if function is already loaded. This is handled by the function


|Datatype - description|Return value=
|r1=
* [[spawn]]: [[Script Handle]]
* [[call]]: [[true]] if action was successful or [[false]] if it was interrupted.


|x1= <code></code>|Example 1=
|x1= <sqf>["Hold that key!", 2, { alive player }] spawn BIS_fnc_keyHold;</sqf>


| |See also=
|x2= Function can be called in [[Scheduler#Scheduled_Environment|scheduled environment]] to return values and be used for further code execution.
<sqf>
0 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
 
|seealso= [[BIS_fnc_holdActionAdd]] [[BIS_fnc_holdKey]]
}}
}}
[[Category:Function Group: GUI|{{uc:keyHold}}]]
[[Category:Functions|{{uc:keyHold}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:keyHold}}]]

Latest revision as of 13:59, 24 May 2023

Hover & click on the images for description

Description

Description:
Allows for hold button interactions. Hold action is started by pressing Space.
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) action duration
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:

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.
0 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