actionKeys: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (add link)
m (Bot: Reverted to revision 104288 by warka on 2017-08-21T08:26:07Z)
(21 intermediate revisions by 13 users not shown)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns a list of [[DIK_KeyCodes|dikCodes]] of buttons assigned to the given user action. You can find the action names in config class ControllerSchemes. |= Description
| 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>
keyWatch[]={24};
</syntaxhighlight>
To retrieve the value, use the property name without 'key':
<code>[[actionKeys]] "Watch"; // 24</code>
In addition, some of the actions are also listed in here: [[inputAction/actions]]|= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


[[Array]] <nowiki>=</nowiki> '''actionKeys''' "UserAction" |= Syntax
|  '''actionKeys''' userAction |= Syntax


|p1= UserAction: [[String]] |= Parameter 1
|p1= userAction: [[String]] |= Parameter 1


| [[Array]] |= Return value
| [[Array]] of [[Number]]s|= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <pre>_array = actionKeys "ReloadMagazine"</pre> |= Example 1
|x1= <code>_array = [[actionKeys]] "ReloadMagazine"</code> |= Example 1
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| [[actionKeysNames]], [[actionKeysNamesArray]], [[actionKeysImages]], [[actionName]], [[inputAction]] |= See also


}}
}}
Line 27: Line 33:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
You can find a list of all available actions [[key_actions_(VBS2)|here]]. The list is for VBS2, so there are a few actions that are not available in Arma.
 
--[[User:General Barron|General Barron]] 06:08, 3 June 2008 (CEST)
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>
Line 38: Line 43:
[[Category:Scripting Commands ArmA|ACTIONKEYS]]
[[Category:Scripting Commands ArmA|ACTIONKEYS]]
[[Category:Command_Group:_Interaction|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Interaction|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on May 11, 2016 - 02:36 (UTC)</dd>
<dt class="note">[[User:AgentRevolution|AgentRev]]</dt>
<dd class="note">
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/>
<br/>
Left Ctrl + Key = 486539264 + DIK<br/>
Left Shift + Key = 704643072 + DIK<br/>
Left Alt + Key = 939524096 + DIK<br/>
Right Ctrl + Key = -1660944384 + DIK<br/>
Right Shift + Key = 905969664 + DIK<br/>
Right Alt + Key = -1207959552 + DIK<br/>
<br/>
<s>For example, to detect if actionKeys "NetworkPlayers" contain a match for  "Right Ctrl + P", one must do the following:
<code> if (-1660944359 in actionKeys "NetworkPlayers") then</code>
with -1660944359 being equal to -1660944384 + 25, and 25 being the DIK code for the "P" key.</s><br/>
<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/>
<br/>
In case of mouse buttons, actionKeys will also return values that are different from those in "MouseButton" UI events:<br/>
<br/>
LMB: MouseButton 0 = actionKeys 65536<br/>
RMB: MouseButton 1 = actionKeys 65665 (65536 + 1 + 128)<br/>
MMB: MouseButton 2 = actionKeys 65538 (65536 + 2)<br/>
4MB: MouseButton 3 = actionKeys 65539 (65536 + 3)<br/>
5MB: MouseButton 4 = actionKeys 65540 (65536 + 4)<br/>
<br/>
The values above are valid for a right-handed mouse configuration, and may or may not differ for a left-handed config.
</dd>
</dl>
<!-- DISCONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on August 6, 2016 - 12:24 (UTC)</dd>
<dt class="note">[[User:Commy2|Commy2]]</dt>
<dd class="note">
The method described by @AgentRev does not work.<br>
All numbers in SQF are floats and those are only precise up to 6...7 digits.<br>
<code>486539264 + 19 == 486539264 + 20
-> true
</code>
The DIK codes for 'LCtrl + R' and 'LCtrl + T' are indistinguishable.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 19:48, 3 December 2018

-wrong parameter ("Arma") defined!-1.00
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:
Uncategorised

Syntax

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

Examples

Example 1:
_array = actionKeys "ReloadMagazine"

Additional Information

See also:
actionKeysNamesactionKeysNamesArrayactionKeysImagesactionNameinputAction

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

Notes

Bottom Section

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.