BIS fnc holdKey: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
(Add default values)
Line 7: Line 7:


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


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


|p1= display: [[Display]] - display the event is attached to. By default it is the map display
|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= key: [[Number]] - what key to press. See [[DIK KeyCodes]]
|p2= key: [[Number]] - (Optional, default 57 for {{Controls|Space}}) what key to press - see [[DIK KeyCodes]]


|p3= time: [[Number]] - how long the key has to be held down in seconds
|p3= time: [[Number]] - (Optional, default 3) how long the key has to be held down in seconds


|p4= code: [[Code]] - code to be executed when key is held down for long enough. [[canSuspend]] returns [[true]] inside the code
|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.
|p5= control: [[Control]] - (Optional, default [[controlNull]]) text control to be used in place of the default "Press X to skip" control.

Revision as of 01:14, 21 May 2023

Hover & click on the images for description

Description

Description:
Function that executes a user-defined code when a key has been held down for a long enough time.
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" }] call BIS_fnc_holdKey; // action is added to the mission display

Additional Information

See also:
BIS_fnc_holdActionAdd addAction

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