CBA_fnc_addKeybind

Description

Adds or updates the keybind handler for a specified mod action, and associates a function with that keybind being pressed.

This file should be included for readable DIK codes

#include “\a3\ui_f\hpp\defineDIKCodes.inc”

Additional DIK codes usable with this function

0xF0: Left mouse button 0xF1: Right mouse button 0xF2: Middle mouse button 0xF3: Mouse #4 0xF4: Mouse #5 0xF5: Mouse #6 0xF6: Mouse #7 0xF7: Mouse #8 0xF8: Mouse wheel up 0xF9: Mouse wheel down

0xFA: Custom user action 1 0xFB: Custom user action 2 0xFC: Custom user action 3 0xFD: Custom user action 4 0xFE: Custom user action 5 0xFF: Custom user action 6 0x100: Custom user action 7 0x101: Custom user action 8 0x102: Custom user action 9 0x103: Custom user action 10 0x104: Custom user action 11 0x105: Custom user action 12 0x106: Custom user action 13 0x107: Custom user action 14 0x108: Custom user action 15 0x109: Custom user action 16 0x10A: Custom user action 17 0x10B: Custom user action 18 0x10C: Custom user action 19 0x10D: Custom user action 20

Parameters

_addonName of the registering mod + optional sub-category <STRING, ARRAY>
_actionId of the key action.  STRING
_titlePretty name, or an array of pretty name and tooltip STRING
_downCodeCode for down event, empty string for no code.  <CODE>
_upCodeCode for up event, empty string for no code.  <CODE>

Optional

_defaultKeybindThe keybinding data in the format [DIK, [shift, ctrl, alt]] ARRAY
_holdKeyWill the key fire every frame while down <BOOLEAN>
_holdDelayHow long after keydown will the key event fire, in seconds.  <NUMBER>
_overwriteOverwrite any previously stored default keybind <BOOLEAN>

Returns

Returns the current keybind for the action ARRAY

Examples

// Register a simple keypress to an action
#include "\a3\ui_f\hpp\defineDIKCodes.inc"

["MyMod", "MyKey", ["My Pretty Key Name", "My Pretty Tool Tip"], {
    _this call mymod_fnc_keyDown
}, {
    _this call mymod_fnc_keyUp
}, [DIK_TAB, [false, false, false]]] call CBA_fnc_addKeybind;

["MyMod", "MyOtherKey", "My Other Pretty Key Name", {
    _this call mymod_fnc_keyDownOther
}, {
    _this call mymod_fnc_keyUpOther
}, [DIK_K, [false, false, false]]] call CBA_fnc_addKeybind;

Author

Taosenai & Nou, commy2

string used by format
Array to read from [Array]
Close