API:SetMacroData
From RoR Wiki
UI Lua API · Hotbar functions
Version: WAR 1.4.8
Sets the name, text and icon of one of the player's macros.
SetMacroData(name, text, iconNum, macroId)
Arguments
- name
wstring– Name of the macro. The client copies it into a buffer of 64 characters.- text
wstring– Macro text (the command line it runs). The client copies it into a buffer of 256 characters.- iconNum
number– Icon id of the macro, for GetIconData.- macroId
number– Macro slot, 1 to 48.
Returns
Nothing.
Details
- The macro in slot
macroIdis overwritten. A slot outside 1 to 48 is not written. - After the call the client sets
GameData.Macros.macrosDirtytotrueand broadcasts an event to the UI, also when the slot was out of range. - If the client's macro list is not available, nothing happens.
nameandtextmust be wide strings; plain Lua strings raise an Invalid Parameters error.
Errors
Error in function call ImportMacroData: You cannot change your macros while in combat.
This check exists in the client but never triggers: the flag it tests is never set.- The generic Invalid Parameters message when an argument has the wrong type.
Example
From ea_macrowindow/source/macrowindow.lua:
SetMacroData( TextEditBoxGetText( "EA_Window_MacroDetailsName" ), TextEditBoxGetText( "EA_Window_MacroDetailsText" ), EA_Window_Macro.iconNum, EA_Window_Macro.activeId )
