WoW API: EditMacro
Jump to navigation
Jump to search
Edit macro command/button.
EditMacro(index or macroName, name, icon, body, local, perCharacter)
This function may only be called when out of combat.
Arguments[edit]
- (index or macroName, name, icon, body, local, perCharacter)
- index or macroName
- Number or string - the index or name of the macro to be edited. Index ranges from 1 to 36 for account wide macros and 37 to 54 for character specific.
- name
- String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit. The name remains unchanged if nil.
- icon
- Numeric - A 1-based iconTextureId (index of icon textures as displayed in "Change Name/Icon" UI). Check the current number of icon textures available by calling GetNumMacroIcons(). The icon remains unchanged if nil.
- body
- String - The macro commands to be executed. If this string is longer than 255 characters, only the first 255 will be saved.
- local
- Numeric - Purpose unknown, always 1.
- perCharacter
- Archaic. Now purposeless, since character and account macros are given unique IDs.
Returns[edit]
- macroId
- Numeric - The new index of the macro, as displayed in the "Create Macros" UI. Same as argument "index" unless the macro name is changed, as they are sorted alphabetically.
Example[edit]
macroId = EditMacro(1, "MyMacro", 12, "/script CastSpellById(1);", 1, 1);
Notes[edit]
- If this function is called from within the macro that is edited, the rest of the macro (from the final character's position of the /run command onward) will run the new version.