WoW:API CreateMacro: Difference between revisions

(Removed 4th parameter (local), it's been removed in WoW 3.0)
Line 2: Line 2:
Creates a new macro command/button.
Creates a new macro command/button.


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


== Arguments ==
== Arguments ==
:(name, icon, body, perCharacter)
:(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.
; name : String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit.
Line 13: Line 13:
; body : String - The macro commands to be executed. If this string is longer than 255 characters, only the first 255 will be saved.
; 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 - 0 will create a "per account" saved macro, 1 will save it as "per character"
; 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 ==
== Returns ==
Line 20: Line 22:


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


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


== Notes ==
== Notes ==
* As of 3.0 with Macros saving serverside (default) the API has changed. perCharacter, and local have switched spots. Pre-3.0 local was always nil.


* 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).
* 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).
Anonymous user