WoW:User interface customization guide: Difference between revisions

Line 26: Line 26:
http://www.lua.org/manual/5.0/  
http://www.lua.org/manual/5.0/  


The best way to become familiar with the way Lua is used to script the interface is to look at the scripts in the XML files, denoted by the <script> tag, and to browse the lua files. The lua files typically contain functions which are used by the corresponding XML files.  
For more concise help, topic-specific Lua tutorials can be found at:
http://lua-users.org/wiki/TutorialDirectory
 
 
The best way to become familiar with the way Lua is used to script the interface is to look at the scripts in the XML files, denoted by the <script> tag, and to browse the lua files. The lua files typically contain functions which are used by the corresponding XML files.


== Getting Started ==
== Getting Started ==
Line 34: Line 38:
At the top of this file is a script block which contains the function _ERRORMESSAGE(), which is called whenever an error occurs in your script. This function pops up a window with the error message. Another function is defined there, message(), which just pops up the error window with the argument to the function.  
At the top of this file is a script block which contains the function _ERRORMESSAGE(), which is called whenever an error occurs in your script. This function pops up a window with the error message. Another function is defined there, message(), which just pops up the error window with the argument to the function.  


Further on on the file a few textures are defined in XML. They have the "virtual" attribute, which means that they are not actually created, only stored definitions to be inherited later. After that a frame, or widget, called "DialogBoxFrame" is defined. This frame is also virtual, and contains an anchor which defines how it's positioned relative to its parent, a background, and a child button which just hides the dialog when it's clicked.  
Further on in the file a few textures are defined in XML. They have the "virtual" attribute, which means that they are not actually created, only stored definitions to be inherited later. After that a frame, or widget, called "DialogBoxFrame" is defined. This frame is also virtual, and contains an anchor which defines how it's positioned relative to its parent, a background, and a child button which just hides the dialog when it's clicked.  


Each frame consists of a number of layers, each of which can contain any number of textures and fontstrings. Each texture and fontstring must be anchored and sized so they are visible. The numbers used for anchor offsets and sizes are values in pixels.  
Each frame consists of a number of layers, each of which can contain any number of textures and fontstrings. Each texture and fontstring must be anchored and sized so they are visible. The numbers used for anchor offsets and sizes are values in pixels.  


At the end of the file we define an actual frame called "ScriptErrors" which inherits the dialog box we defined previously. This is the frame which is shown in the message function at the top of the file.  
At the end of the file we define an actual frame called "ScriptErrors" which inherits the dialog box we defined previously. This is the frame which is shown in the message function at the top of the file.


== How Does It Work? ==
== How Does It Work? ==
Anonymous user