-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathfnc_readKeyFromConfig.sqf
More file actions
49 lines (37 loc) · 1.24 KB
/
fnc_readKeyFromConfig.sqf
File metadata and controls
49 lines (37 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_readKeyFromConfig
Description:
Reads key setting from config.
Parameters:
_component - Classname under "CfgSettings" >> "CBA" >> "events" <STRING>
_action - Action name <STRING>
Returns:
_key - Key (DIK-Code) <NUMBER>
_settings - Shift, Ctrl, Alt modifiers <ARRAY>
Examples:
(begin example)
_keyConfig = ["cba_sys_nvg", "nvgon"] call CBA_fnc_readKeyFromConfig;
(end)
Author:
Sickboy, commy2
---------------------------------------------------------------------------- */
SCRIPT(readKeyFromConfig);
params [["_component", "", [""]], ["_action", "", [""]]];
private _config = CFGSETTINGS >> _component >> _action;
private _key = -1;
private _settings = [false, false, false];
if (isNumber _config) then {
TRACE_2("",_this,getNumber _config);
_key = getNumber _config;
};
if (isClass _config) then {
TRACE_2("",_this,getNumber (_config >> "key"));
_key = getNumber (_config >> "key");
{
if (getNumber (_config >> _x) == 1) then {
_settings set [_forEachIndex, true];
};
} forEach ["shift", "ctrl", "alt"];
};
[_key, _settings]