no edit summary
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
Creates a new macro command/button. | Creates a new macro command/button. | ||
CreateMacro(name, icon, body, local) | CreateMacro(name, icon, body, local, perCharacter) | ||
== Arguments == | == Arguments == | ||
:(name, icon, body, local) | :(name, icon, body, local, perCharacter) | ||
; name : String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit. | ; name : String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit. | ||
| Line 12: | Line 12: | ||
; local : Numeric - Purpose unknown, always 1. | ; local : Numeric - Purpose unknown, always 1. | ||
; perCharcter : Numeric - 0 will create a "per account" saved macro, 1 will save it as "per character" | |||
== Returns == | == Returns == | ||
| Line 19: | Line 21: | ||
== Example == | == Example == | ||
local macroId = CreateMacro("MyMacro", 12, "/script CastSpellById(1);", 1); | local macroId = CreateMacro("MyMacro", 12, "/script CastSpellById(1);", 1, 1); | ||
== Notes == | == Notes == | ||
| Line 25: | Line 27: | ||
It is possible to do some WrongThings(tm) here: | It is possible to do some WrongThings(tm) here: | ||
* 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) before calling CreateMacro(). | * 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. | * 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. | ||