API CreateMacro

Creates a new macro command/button.

CreateMacro("name", iconIndex, "body", perCharacter, local)

Arguments

 * (name, icon, body, perCharacter, local)


 * name : String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit.


 * 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 GetNumMacroIcons.


 * body : String - The macro commands to be executed. If this string is longer than 255 characters, only the first 255 will be saved.


 * perCharcter : Numeric - nil will create a "General" saved macro, 1 will save it as "Per Character"


 * local : 1 if the macro is to be saved on the server, nil if saved locally in the user's WTF folder

Returns

 * macroId : Numeric - The 1-based index of the newly-created macro, as displayed in the "Create Macros" UI.

Example
local macroId = CreateMacro("MyMacro", 12, "/script CastSpellById(1);", nil, 1); local macroId = CreateMacro("MyMacro", 12, "/script CastSpellById(1);", nil, nil);
 * General (All Character) Macros :

local macroId = CreateMacro("MyMacro", 12, "/script CastSpellById(1);", 1, 1); local macroId = CreateMacro("MyMacro", 12, "/script CastSpellById(1);", 1, nil);
 * perChar (Per Character) Macros :