actionKeys: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "|game4= arma2oa |version4= 1.51 " to "|game4= arma2oa |version4= 1.50 ") |
Lou Montana (talk | contribs) m (Fix SQF) |
||
(21 intermediate revisions by 3 users not shown) | |||
Line 22: | Line 22: | ||
|descr= Returns [[Array]] containing [[DIK_KeyCodes|dikCodes]] of keys, buttons and combos assigned to the given user action. Action names could be found in config class ControllerSchemes or [[:Category:Key Actions|user action names]] or user profile, for example: | |descr= Returns [[Array]] containing [[DIK_KeyCodes|dikCodes]] of keys, buttons and combos assigned to the given user action. Action names could be found in config class ControllerSchemes or [[:Category:Key Actions|user action names]] or user profile, for example: | ||
<syntaxhighlight lang=cpp> | <syntaxhighlight lang="cpp"> | ||
keyWatch[] = { 24 }; | keyWatch[] = { 24 }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To retrieve the value, use the property name without 'key': | To retrieve the value, use the property name without 'key': | ||
< | <sqf>actionKeys "Watch"; // 24</sqf> | ||
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 34: | Line 34: | ||
|r1= [[Array]] of [[Number]]s | |r1= [[Array]] of [[Number]]s | ||
|seealso= [[actionKeysNames]] | |s2= [[actionKeys]] [userAction] | ||
|s2since=Arma3 2.08 | |||
|p21= userAction: [[String]] | |||
|r2= [[Array]] of [[String]]s | |||
|x1= <sqf>_arrayOfNumbers = actionKeys "ReloadMagazine";</sqf> | |||
|x2= From {{arma3}} v2.08: <sqf>_arrayOfStrings = actionKeys ["ReloadMagazine"];</sqf> | |||
|seealso= [[actionKeysNames]] [[actionKeysNamesArray]] [[actionKeysImages]] [[actionName]] [[inputAction]] [[addUserActionEventHandler]] | |||
}} | }} | ||
{{Note | |||
|user= AgentRev | |||
|timestamp= 20160511023600 | |||
|text= 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:<br> | |||
: Left Ctrl + Key = 486539264 + DIK | |||
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:<br> | : Left Shift + Key = 704643072 + DIK | ||
: Left Alt + Key = 939524096 + DIK | |||
Left Shift + Key = 704643072 + DIK | : Right Ctrl + Key = -1660944384 + DIK | ||
Left Alt + Key = 939524096 + DIK | : Right Shift + Key = 905969664 + DIK | ||
Right Ctrl + Key = -1660944384 + DIK | : Right Alt + Key = -1207959552 + DIK</sqf> | ||
Right Shift + Key = 905969664 + DIK | |||
Right Alt + Key = -1207959552 + DIK</ | This increases the difficulty of accurately comparing key codes to actionKeys in [[User_Interface_Event_Handlers|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 [[Profile|ArmaProfile]].<br> | ||
This increases the difficulty of accurately comparing key codes to actionKeys in [[User_Interface_Event_Handlers|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.<br> | |||
In case of mouse buttons, actionKeys will also return values that are different from those in "MouseButton" UI events:<br> | In case of mouse buttons, actionKeys will also return values that are different from those in "MouseButton" UI events:<br> | ||
: LMB: MouseButton 0 = actionKeys 65536 | |||
: RMB: MouseButton 1 = actionKeys 65665 (65536 + 1 + 128) | |||
RMB: MouseButton 1 = actionKeys 65665 (65536 + 1 + 128) | : MMB: MouseButton 2 = actionKeys 65538 (65536 + 2) | ||
MMB: MouseButton 2 = actionKeys 65538 (65536 + 2) | : 4MB: MouseButton 3 = actionKeys 65539 (65536 + 3) | ||
4MB: MouseButton 3 = actionKeys 65539 (65536 + 3) | : 5MB: MouseButton 4 = actionKeys 65540 (65536 + 4) | ||
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. | The values above are valid for a right-handed mouse configuration, and may or may not differ for a left-handed config. | ||
<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> | ||
}} | |||
{{Note | |||
|user= Commy2 | |||
|timestamp= 20160806122400 | |||
'''The | |text= '''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> | ||
< | <sqf>486539264 + 19 == 486539264 + 20 // returns true</sqf> | ||
The DIK codes for | 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> | ||
}} | |||
Latest revision as of 17:06, 1 November 2022
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':
In addition, some of the actions are also listed in here: inputAction/actionsactionKeys "Watch"; // 24 - 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:
- Example 2:
- From Arma 3 v2.08:
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)
-
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</sqf>
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)
Note edited by R3vo (talk) 13:04, 19 March 2021 (CET)
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Elite version 1.00
- Operation Flashpoint: Elite: New Scripting Commands
- Operation Flashpoint: Elite: Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Interaction