[info] how to hack in a global keybind

+
Global in the sense that you can use it in any actor state and also within game menus.

In case anyone is looking for this information, since it's nigh impossible to edit .redswf files...

note: Replace 'hotkeyActionName', customHotkey, customConditions, OnCustomEventName and IK_F4.

Add localization text for keybinds menu if desired, and update input.settings with BASE_PanelsShortcuts as well.
ref: commonMenu.ws (CR4CommonMenu)
ref: protected var craftingHotkey:EInputKey;
ie: protected var customHotkey:EInputKey;

ref: protected function fetchCurrentHotkeys() : void
ie: theInput.GetPCKeysForAction('hotkeyActionName', outKeys);

ref: event OnHotkeyTriggered(keyCode:EInputKey)
ie: else if (keyCode == customHotkey && customConditions)
The Rest is pretty standard for key bindings:
ref: playerInput.ws - public function Initialize()
ref: theInput.RegisterListener( this, 'OnCommSteelSword', 'SteelSword' );
ie: theInput.RegisterListener( this, 'OnCustomEventName', 'customActionName' );

ref: event OnCommSteelSword( action : SInputAction )
ie: event OnCustomEventName( action : SInputAction )

ref: input.xml
ie: <Var builder="Input" id="hotkeyActionName" displayName="modName_localString" displayType="INPUTPC" actions="hotkeyActionName"/>

ref: input_qwerty.ini
ref: [BASE_PanelsShortcuts]
ie: IK_F4=(Action=hotkeyActionName)
Not sure why they didn't just read these values from [BASE_PanelsShortcuts] or setup another 'global' category, but there it is...

Note also that OnHotkeyTriggered() [commonMenu.ws] code will process in menus, and theInput.RegisterListener() [playerInput.ws] code will process in various game or actor states, depending on which .ini keybinds file section/group you place it in. It's possible to have it trigger only in certain states.
 
Last edited:
Top Bottom