WoW:API EditMacro: Difference between revisions
Jump to navigation
Jump to search
(→Arguments: updated info on perCharacter) |
(mostly clarification) |
||
Line 2: | Line 2: | ||
Edit macro command/button. | Edit macro command/button. | ||
EditMacro(index, name, icon, body, local, perCharacter) | EditMacro(index or macroName, name, icon, body, local, perCharacter) | ||
This function may only be called when out of combat. | This function may only be called when out of combat. | ||
== Arguments == | == Arguments == | ||
:(index, name, icon, body, local, perCharacter) | :(index or macroName, name, icon, body, local, perCharacter) | ||
; index : | ; index or macroName : Number or string - the index or name of the macro to be edited. Index ranges from 1 to 36 for account wide macros and 37 to 54 for character specific. | ||
; 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. The name remains unchanged if nil. | ||
; icon : Numeric - A 1-based iconTextureId (index of icon textures as displayed in "Change Name/Icon" UI). Check the current number | ; icon : Numeric - A 1-based iconTextureId (index of icon textures as displayed in "Change Name/Icon" UI). Check the current number of icon textures available by calling [[API GetNumMacroIcons|GetNumMacroIcons()]]. The icon remains unchanged if nil. | ||
; 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. | ||
Line 22: | Line 22: | ||
== Returns == | == Returns == | ||
; macroId : Numeric - The | ; macroId : Numeric - The new index of the macro, as displayed in the "Create Macros" UI. Same as argument "index" unless the macro name is changed, as they are sorted alphabetically. | ||
== Example == | == Example == | ||
Line 29: | Line 29: | ||
== Notes == | == Notes == | ||
*If this function is called from within the macro that is edited, the rest of the macro (from the final character's position of the /run command onward) will run the new version. |
Revision as of 09:56, 16 April 2009
Edit macro command/button.
EditMacro(index or macroName, name, icon, body, local, perCharacter)
This function may only be called when out of combat.
Arguments
- (index or macroName, name, icon, body, local, perCharacter)
- index or macroName
- Number or string - the index or name of the macro to be edited. Index ranges from 1 to 36 for account wide macros and 37 to 54 for character specific.
- name
- String - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit. The name remains unchanged if nil.
- icon
- Numeric - A 1-based iconTextureId (index of icon textures as displayed in "Change Name/Icon" UI). Check the current number of icon textures available by calling GetNumMacroIcons(). The icon remains unchanged if nil.
- 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.
- perCharacter
- Archaic. Now purposeless, since character and account macros are given unique IDs.
Returns
- macroId
- Numeric - The new index of the macro, as displayed in the "Create Macros" UI. Same as argument "index" unless the macro name is changed, as they are sorted alphabetically.
Example
macroId = EditMacro(1, "MyMacro", 12, "/script CastSpellById(1);", 1, 1);
Notes
- If this function is called from within the macro that is edited, the rest of the macro (from the final character's position of the /run command onward) will run the new version.