BIS fnc holdKey: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (game version changed from arma3 dev to arma3, v1.79 to 1.78 (patch version), see https://dev.arma3.com/post/spotrep-00076)
m (linked BIS_fnc_keyHold for convenience)
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.78


| arma3|= Game name
|gr1= Interaction


|1.78|= Game version
|descr= 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.<br>
____________________________________________________________________________________________
All other keys (but {{Controls|Esc}}) are deactivated until the conditions are met - only mouse controls work (character rotation and fire).


|Function that executes a user-defined code when a key has been held down for a long enough time. |= Description
|exec= spawn
____________________________________________________________________________________________


|[display, key, time, code, control] call '''BIS_fnc_holdKey'''|= Syntax
|s1= [display, key, time, code, control] call [[BIS_fnc_holdKey]]


|p1= [[Display]] - display - Display the event is attached to (map display is default).|= Parameter 1
|p1= display: [[Display]] - (Optional, default <sqf inline>findDisplay 12</sqf> for map display) display the event is attached to. By default it is the map display
|p2= [[Number]] - key  - What key to press.|= Parameter 2
|p3= [[Number]] - time  - how long the key has to be held down in seconds.|= Parameter 3
|p4= [[Code]] - code  - Code to be executed when key is held down for long enough.|= Parameter 4
|p5= [[Control]] - control - Optional - text control to be used in place of the default "Press X to skip" control.|= Parameter 5


| None |= Return value
|p2= key: [[Number]] - (Optional, default 57 for {{Controls|Space}}) what key to press - see [[DIK KeyCodes]]
____________________________________________________________________________________________


|x1= <code><nowiki>[</nowiki>[[findDisplay]] 46,36,5, {[[hint]] "Key 'J' pressed for 5 seconds"}] [[call]] [[BIS_fnc_holdKey]]; // Action is added to the mission display</code> |= Example 1
|p3= time: [[Number]] - (Optional, default 3) how long the key has to be held down in seconds
____________________________________________________________________________________________


| [[BIS_fnc_holdActionAdd]], [[addAction]] |= See also
|p4= code: [[Code]] - (Optional, default <sqf inline>{}</sqf>) [[Scheduler#Scheduled Environment|scheduled]] code to be executed when key is held down for long enough


}}
|p5= control: [[Control]] - (Optional, default [[controlNull]]) text control to be used in place of the default "Press X to skip" control.
 
|r1= [[Nothing]]


<h3 style="display:none">Notes</h3>
|x1= <sqf>[findDisplay 46, 36, 5, { hint "Key 'J' pressed for 5 seconds" }] spawn BIS_fnc_holdKey; // action is added to the mission display</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


</dl>
|seealso= [[BIS_fnc_holdActionAdd]] [[addAction]] [[BIS_fnc_keyHold]]
<!-- DISCONTINUE Notes -->
}}

Latest revision as of 21:02, 5 June 2023

Hover & click on the images for description

Description

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.
All other keys (but Esc) are deactivated until the conditions are met - only mouse controls work (character rotation and fire).
Execution:
spawn
Groups:
Interaction

Syntax

Syntax:
[display, key, time, code, control] call BIS_fnc_holdKey
Parameters:
display: Display - (Optional, default findDisplay 12 for map display) display the event is attached to. By default it is the map display
key: Number - (Optional, default 57 for Space) what key to press - see DIK KeyCodes
time: Number - (Optional, default 3) how long the key has to be held down in seconds
code: Code - (Optional, default {}) scheduled code to be executed when key is held down for long enough
control: Control - (Optional, default controlNull) text control to be used in place of the default "Press X to skip" control.
Return Value:
Nothing

Examples

Example 1:
[findDisplay 46, 36, 5, { hint "Key 'J' pressed for 5 seconds" }] spawn BIS_fnc_holdKey; // action is added to the mission display

Additional Information

See also:
BIS_fnc_holdActionAdd addAction BIS_fnc_keyHold

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