API:WindowSetGameActionTrigger
From RoR Wiki
UI Lua API · Window functions
Version: WAR 1.4.8
Binds a window to a key-binding action, so that the action's key triggers the window.
WindowSetGameActionTrigger(windowName, actionId)
Arguments
- windowName
string– Name of the window.- actionId
number– Id of a key-binding action, for example fromGetActionIdFromNameorSystemData.Settings.Keybindings.*.id. 0 removes the binding.
Returns
Nothing.
Details
- Any action the window was bound to before is unbound first. With 0, no new binding is made.
actionIdis truncated to a whole number. When the client registers or unregisters the binding it uses only the low 16 bits of the id.- The stock action bars and morale bar use it to connect their buttons to the hotkeys (see the examples).
- The No window specified error exists in the client but cannot be raised: a missing name is replaced by an empty string first, which gives the does not exist error.
Errors
Error in function call 'WindowSetGameActionTrigger': Window %s does not exist.Error in function call 'WindowSetGameActionTrigger': Window %s is currently locked and may not be modified from lua. ...
This check never triggers in the current client. See WindowSetShowing.
Example
From ea_actionbars/source/actionbutton.lua:
WindowSetGameActionTrigger (windowName, GetActionIdFromName (actionButton:GetActionName ()))
From ea_moralewindow/source/moralewindow.lua:
-- Bind the action buttons to the hotkey keyboard events. local actionTrigger = SystemData.Settings.Keybindings.MORALE_BAR_1.id + moraleLevel - 1 WindowSetGameActionTrigger (moraleButton:GetName (), actionTrigger)
