actionKeys: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - ":<code>" to ": <code>")
m (Text replacement - "<code>([^ ]*)\[\[([a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "<code>$1$2$3</code>")
Line 26: Line 26:
</syntaxhighlight>
</syntaxhighlight>
To retrieve the value, use the property name without 'key':
To retrieve the value, use the property name without 'key':
<code>[[actionKeys]] "Watch"; {{cc|24}}</code>
<code>actionKeys "Watch"; {{cc|24}}</code>
In addition, some of the actions are also listed in here: [[inputAction/actions]]
In addition, some of the actions are also listed in here: [[inputAction/actions]]


Line 42: Line 42:
|r2= [[Array]] of [[String]]s
|r2= [[Array]] of [[String]]s


|x1= <code>_arrayOfNumbers = [[actionKeys]] "ReloadMagazine";</code>
|x1= <code>_arrayOfNumbers = actionKeys "ReloadMagazine";</code>
|x2= From Arma 3 v2.08:
|x2= From Arma 3 v2.08:
<code>_arrayOfStrings = [[actionKeys]] ["ReloadMagazine"];</code>
<code>_arrayOfStrings = actionKeys ["ReloadMagazine"];</code>


|seealso= [[actionKeysNames]] [[actionKeysNamesArray]] [[actionKeysImages]] [[actionName]] [[inputAction]] [[addUserActionEventHandler]]
|seealso= [[actionKeysNames]] [[actionKeysNamesArray]] [[actionKeysImages]] [[actionName]] [[inputAction]] [[addUserActionEventHandler]]
Line 78: Line 78:
<dd class="note">
<dd class="note">
'''The values described by {{User|AgentRev}} cannot be compared <u>reliably</u>.''' All numbers in SQF are floats and those are only precise up to 7 digits.<br>
'''The values described by {{User|AgentRev}} cannot be compared <u>reliably</u>.''' All numbers in SQF are floats and those are only precise up to 7 digits.<br>
<code>486539264 + 19 == 486539264 + 20 {{cc|Returns [[true]]}}</code>
<code>486539264 + 19 == 486539264 + 20 {{cc|Returns true}}</code>
The DIK codes for {{hl|LCtrl + R}} and {{hl|LCtrl + T}} are indistinguishable.
The DIK codes for {{hl|LCtrl + R}} and {{hl|LCtrl + T}} are indistinguishable.
<br><small>''Note edited by [[User:R3vo|R3vo]] ([[User talk:R3vo|talk]]) 13:04, 19 March 2021 (CET)''</small>
<br><small>''Note edited by [[User:R3vo|R3vo]] ([[User talk:R3vo|talk]]) 13:04, 19 March 2021 (CET)''</small>

Revision as of 12:01, 12 May 2022

Hover & click on the images for description

Description

Description:
Returns Array containing dikCodes of keys, buttons and combos assigned to the given user action. Action names could be found in config class ControllerSchemes or user action names or user profile, for example:
keyWatch[] = { 24 };

To retrieve the value, use the property name without 'key': actionKeys "Watch"; // 24

In addition, some of the actions are also listed in here: inputAction/actions
Groups:
Interaction

Syntax

Syntax:
actionKeys userAction
Parameters:
userAction: String
Return Value:
Array of Numbers

Alternative Syntax

Syntax:
actionKeys [userAction]
Parameters:
userAction: String
Return Value:
Array of Strings

Examples

Example 1:
_arrayOfNumbers = actionKeys "ReloadMagazine";
Example 2:
From Arma 3 v2.08: _arrayOfStrings = actionKeys ["ReloadMagazine"];

Additional Information

See also:
actionKeysNames actionKeysNamesArray actionKeysImages actionName inputAction addUserActionEventHandler

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
Posted on May 11, 2016 - 02:36 (UTC)
AgentRev
If an action key is configured with a modifier (e.g. "Right Ctrl + M" for "MiniMapToggle"), the DIK code returned by this command has a weird value, equivalent to the following:
Left Ctrl + Key = 486539264 + DIK Left Shift + Key = 704643072 + DIK Left Alt + Key = 939524096 + DIK Right Ctrl + Key = -1660944384 + DIK Right Shift + Key = 905969664 + DIK Right Alt + Key = -1207959552 + DIK This increases the difficulty of accurately comparing key codes to actionKeys in UI event handlers. Those strange numbers are probably due to bit flags being added to the DIK value by the game engine for easier storage in the ArmaProfile.
In case of mouse buttons, actionKeys will also return values that are different from those in "MouseButton" UI events:
LMB: MouseButton 0 = actionKeys 65536 RMB: MouseButton 1 = actionKeys 65665 (65536 + 1 + 128) MMB: MouseButton 2 = actionKeys 65538 (65536 + 2) 4MB: MouseButton 3 = actionKeys 65539 (65536 + 3) 5MB: MouseButton 4 = actionKeys 65540 (65536 + 4) The values above are valid for a right-handed mouse configuration, and may or may not differ for a left-handed config.
Note edited by R3vo (talk) 13:04, 19 March 2021 (CET)
Posted on August 6, 2016 - 12:24 (UTC)
Commy2
The values described by AgentRev cannot be compared reliably. All numbers in SQF are floats and those are only precise up to 7 digits.
486539264 + 19 == 486539264 + 20 // Returns true The DIK codes for LCtrl + R and LCtrl + T are indistinguishable.
Note edited by R3vo (talk) 13:04, 19 March 2021 (CET)