WoW:API and scripting quirks: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (→‎World of Warcraft Scripting Quirks: Added note to look in Logs directory.)
mNo edit summary
Line 20: Line 20:
* [[Output]]
* [[Output]]
** The only file output allowed is when the UI engine saves variables before it exits or reloads. Addons use the ## SavedVariables: header to indicate which data they wish to save.
** The only file output allowed is when the UI engine saves variables before it exits or reloads. Addons use the ## SavedVariables: header to indicate which data they wish to save.
** Another way to output data is to save certain variables using the SetCVar() function.  This will immediatly do an export of the config.wtf file that contains various in game variables.  This will not allow you to create new variables to export out, just set non default values to certian in game variables.
** Another way to output data is to save certain variables using the SetCVar() function.  This will immediatly do an export of the config.wtf file that contains various in game variables.  This will not allow you to create new variables to export out, just set non default values to certain in game variables.


* [[World of Warcraft API|Functions]]
* [[World of Warcraft API|Functions]]
** x,y = GetCursorPosition(); will return the current position of the mouse '''with respect to the object it currently is in'''.  This means x will be 0 if the mouse is at the left edge of a frame or button, regardless of where that frame or button is.
** x,y = GetCursorPosition(); will return the current position of the mouse '''with respect to the object it currently is in'''.  This means x will be 0 if the mouse is at the left edge of a frame or button, regardless of where that frame or button is.
** x,y = GetCursorPosition(UIParent); will return the current position of the mouse with respect to the entire UI.  This can be considered the absolute position..
** x,y = GetCursorPosition(UIParent); will return the current position of the mouse with respect to the entire UI.  This can be considered the absolute position..

Revision as of 01:04, 14 May 2005

World of Warcraft Scripting Quirks

  • Macros
    • Can only cast spells from a hotkey or mouse click
    • Macros cannot cast spells on a delay
    • /cast only works in Macros
    • only one spell or action can be triggered per button press
  • Frames
    • OnUpdate handlers are only called when the frame is visible.
    • OnUpdate handles are called every frame. Use with care.
    • When inheriting frames, you can access the parent frame name with $parent.
    • All Frames have a GetID() function which will obtain the ID specified in the XML.
    • If you don't specify parent="UIParent" in your top-level frames, your frames won't be scaled according to the currently active UI scale. This can lead to some hair-pulling as you try to figure out why your fonts are so huge. (But, in some cases, not having that scaling might be desirable.)
    • If you get no error output, but your addon is simply not being loaded, make sure you don't have a syntax error in your .xml file. A simple way to ensure that your xml is well-formed is to open it in Firefox; it will point out any XML structure errors to you. You can also check the contents of your Logs directory for errors.
  • Output
    • The only file output allowed is when the UI engine saves variables before it exits or reloads. Addons use the ## SavedVariables: header to indicate which data they wish to save.
    • Another way to output data is to save certain variables using the SetCVar() function. This will immediatly do an export of the config.wtf file that contains various in game variables. This will not allow you to create new variables to export out, just set non default values to certain in game variables.
  • Functions
    • x,y = GetCursorPosition(); will return the current position of the mouse with respect to the object it currently is in. This means x will be 0 if the mouse is at the left edge of a frame or button, regardless of where that frame or button is.
    • x,y = GetCursorPosition(UIParent); will return the current position of the mouse with respect to the entire UI. This can be considered the absolute position..