WoW:API CreateMacro: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 11: Line 11:
; icon : Numeric - A 1-based iconTextureId (index of icon textures as displayed in "Change Name/Icon" UI). Check the current number if icon textures available by calling [[API GetNumMacroIcons|GetNumMacroIcons()]].
; icon : Numeric - A 1-based iconTextureId (index of icon textures as displayed in "Change Name/Icon" UI). Check the current number if icon textures available by calling [[API GetNumMacroIcons|GetNumMacroIcons()]].


; body : String - The macro commands to be executed.
; 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.
; local : Numeric - Purpose unknown, always 1.
Line 27: Line 27:
== Notes ==
== Notes ==


It is possible to do some WrongThings(tm) here:
* This function will generate an error if 18 macros of the specified kind already exist.


* It is possible to create more macros than the UI can display. Call [[API GetNumMacros|GetNumMacros()]] to ensure there are no more than 17 macros (18 is the current UI limit per account/per character) before calling CreateMacro().
* It is possible to create macros with duplicate names. You should enumerate the current macros using [[API GetNumMacros|GetNumMacros()]] and [[API GetMacroIconInfo|GetMacroIconInfo(macroId)]] to ensure that your new macro name doesn't already exist. Macros with duplicate names can be used in most situations, but the behavior of macro functions that retrieve a macro by name is undefined when multiple macros of that name exist.
 
* It is possible to create macros with duplicate names. You should enumerate the current macros using [[API GetNumMacros|GetNumMacros()]] and [[API GetMacroIconInfo|GetMacroIconInfo(macroId)]] to ensure that your new macro name doesn't already exist.


This function may not be called in combat anymore, as of 2.0.
This function may not be called in combat anymore, as of 2.0.
Anonymous user