2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Revert a key code to a readible text.
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: Key code (Number)
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* What input will result in the given key code? (String)
|
|
|
|
*/
|
2015-01-12 18:22:58 +00:00
|
|
|
#include "\z\ace\addons\common\script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
private ["_keyCode", "_key", "_alt", "_ctrl", "_shft"];
|
|
|
|
|
|
|
|
_keyCode = _this select 0;
|
|
|
|
|
|
|
|
_key = toString ((toArray keyName floor _keyCode) - [34]);
|
|
|
|
|
|
|
|
_keyCode = round ((_keyCode % 1) * 10);
|
|
|
|
|
|
|
|
switch (_keyCode) do {
|
2015-01-11 18:20:14 +00:00
|
|
|
case 8 : {format [localize QUOTE(DOUBLES(STR,GVAR(DoubleTapKey))), _key]};
|
|
|
|
case 9 : {format [localize QUOTE(DOUBLES(STR,GVAR(HoldKey))), _key]};
|
2015-01-11 16:42:31 +00:00
|
|
|
default {
|
2015-01-11 18:20:14 +00:00
|
|
|
_keyCode = toArray ([_keyCode, 3] call FUNC(toBin));
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_alt = "1" == toString [_keyCode select 0];
|
|
|
|
_ctrl = "1" == toString [_keyCode select 1];
|
|
|
|
_shift = "1" == toString [_keyCode select 2];
|
|
|
|
|
|
|
|
format ["%1%2%3%4",
|
2015-01-11 18:20:14 +00:00
|
|
|
["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Alt)))]] select _alt,
|
|
|
|
["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Ctrl)))]] select _ctrl,
|
|
|
|
["", format ["%1 + ", localize QUOTE(DOUBLES(STR,GVAR(Shift)))]] select _shift,
|
2015-01-11 16:42:31 +00:00
|
|
|
_key
|
|
|
|
]
|
|
|
|
};
|
|
|
|
};
|