{"name":"actionKeys","operator":null,"title":"actionKeys","type":"command","url":"https://community.bistudio.com/wiki/actionKeys","revid":330779,"updated":"2022-11-01T16:06:07Z","groups":["Interaction"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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:\n\n```cpp\nkeyWatch[] = { 24 };\n```\n\nTo retrieve the value, use the property name without 'key':\n\n```sqf\nactionKeys \"Watch\"; // 24\n```\n\nIn addition, some of the actions are also listed in here: inputAction/actions","syntaxes":[{"syntax":"actionKeys userAction","since":null,"effect":null,"exec":null,"params":[{"name":"userAction","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"userAction: String"}],"returns":{"type":"Array of Numbers","types":["Array","Number"],"description":null,"text":"Array of Numbers"},"form":"unary","operator":null,"left":null,"right":{"text":"userAction","types":["String"]}},{"syntax":"actionKeys [userAction]","since":"Arma3 2.08","effect":null,"exec":null,"params":[{"name":"userAction","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"userAction: String"}],"returns":{"type":"Array of Strings","types":["Array","String"],"description":null,"text":"Array of Strings"},"form":"unary","operator":null,"left":null,"right":{"text":"[userAction]","types":["Array"]}}],"examples":[{"text":"```sqf\n_arrayOfNumbers = actionKeys \"ReloadMagazine\";\n```","code":["_arrayOfNumbers = actionKeys \"ReloadMagazine\";"]},{"text":"From Arma 3 v2.08: \n\n```sqf\n_arrayOfStrings = actionKeys [\"ReloadMagazine\"];\n```","code":["_arrayOfStrings = actionKeys [\"ReloadMagazine\"];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["actionKeysNames","actionKeysNamesArray","actionKeysImages","actionName","inputAction","addUserActionEventHandler"],"notes":[{"user":"AgentRev","date":"2016-05-11T02:36:00Z","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:\n\nLeft Ctrl + Key = 486539264 + DIK\nLeft Shift + Key = 704643072 + DIK\nLeft Alt + Key = 939524096 + DIK\nRight Ctrl + Key = -1660944384 + DIK\nRight Shift + Key = 905969664 + DIK\nRight Alt + Key = -1207959552 + DIK</sqf>\n\nThis 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.\n\nIn case of mouse buttons, actionKeys will also return values that are different from those in \"MouseButton\" UI events:\n\nLMB: MouseButton 0 = actionKeys 65536\nRMB: MouseButton 1 = actionKeys 65665 (65536 + 1 + 128)\nMMB: MouseButton 2 = actionKeys 65538 (65536 + 2)\n4MB: MouseButton 3 = actionKeys 65539 (65536 + 3)\n5MB: MouseButton 4 = actionKeys 65540 (65536 + 4)\nThe values above are valid for a right-handed mouse configuration, and may or may not differ for a left-handed config.\n\n*Note edited by R3vo (talk) 13:04, 19 March 2021 (CET)*"},{"user":"Commy2","date":"2016-08-06T12:24:00Z","text":"**The values described by AgentRev cannot be compared reliably.** All numbers in SQF are floats and those are only precise up to 7 digits.\n\n```sqf\n486539264 + 19 == 486539264 + 20 // returns true\n```\n\nThe DIK codes for `LCtrl + R` and `LCtrl + T` are indistinguishable.\n\n*Note edited by R3vo (talk) 13:04, 19 March 2021 (CET)*"}],"categories":[]}