Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
→ WoW API
Creates a new macro command/button.
CreateMacro(name, iconFileName, body, perCharacter)
- (name, iconFileName, body, perCharacter)
- String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit.
- String , The icon name.
- String - The macro commands to be executed. If this string is longer than 255 characters, only the first 255 will be saved.
- Numeric - nil will create a "General" saved macro, 1 will save it as "Per Character"
- Numeric - The 1-based index of the newly-created macro, as displayed in the "Create Macros" UI.
- General (All Character) Macros
local macroId = CreateMacro("MyMacro", "INV_MISC_QUESTIONMARK", "/script CastSpellById(1);", nil);
- perChar (Per Character) Macros
local macroId = CreateMacro("MyMacro", "INV_MISC_QUESTIONMARK", "/script CastSpellById(1);", 1);
- As of Patch 4.3 this is working as shown - the unused parameter has been removed.
- This function will generate an error if the maximum macros of the specified kind already exist (36 for per acount and 18 for per character).
- It is possible to create macros with duplicate names. You should enumerate the current macros using GetNumMacros() and 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.
- This function may not be called in combat anymore, as of Patch 2.0.