actionKeys: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "\[\[[cC]ategory:[sS]cripting [cC]ommands\|[a-z A-Z 0-9_]+\]\]" to "") |
Lou Montana (talk | contribs) m (Text replacement - "\| *((\[\[.*\]\],? ?)+) * \}\}" to "|seealso= $1 }}") |
||
Line 23: | Line 23: | ||
|x1= <code>_array = [[actionKeys]] "ReloadMagazine"</code> | |x1= <code>_array = [[actionKeys]] "ReloadMagazine"</code> | ||
| [[actionKeysNames]], [[actionKeysNamesArray]], [[actionKeysImages]], [[actionName]], [[inputAction]] | |seealso= [[actionKeysNames]], [[actionKeysNamesArray]], [[actionKeysImages]], [[actionName]], [[inputAction]] | ||
}} | }} | ||
Revision as of 23:21, 16 February 2021
Description
- Description:
- Description needed
- Groups:
- Interaction
Syntax
- Syntax:
- Syntax needed
- Parameters:
- userAction: String
- Return Value:
- Return value needed
Examples
- Example 1:
_array = actionKeys "ReloadMagazine"
Additional Information
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
For example, to detect if actionKeys "NetworkPlayers" contain a match for "Right Ctrl + P", one must do the following:if (-1660944359 in actionKeys "NetworkPlayers") then
with -1660944359 being equal to -1660944384 + 25, and 25 being the DIK code for the "P" key.
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. - Posted on August 6, 2016 - 12:24 (UTC)
- Commy2
-
The method described by @AgentRev does not work.
All numbers in SQF are floats and those are only precise up to 6...7 digits.
486539264 + 19 == 486539264 + 20 -> true
The DIK codes for 'LCtrl + R' and 'LCtrl + T' are indistinguishable.