INTERFACE CUSTUMIZATION CHUMPY:
World of Warcraft Interface Customization Guide
The interface of World of Warcraft is built from XML files which describe the look and layout, and lua files which contain scripting functionality. This document is a short introduction into modifying these files to customize your interface. Customizing the interface is a very technical endeavor, and you should not attempt it unless you have a good working knowledge of XML and Lua.
There is no official support for modifying the WoW interface. If you break it, you get to keep both pieces.
You can download the current set of interface files from:
https://12.129.233.207/interface-download.aspx
To start fresh, unpack Interface.zip in your World of Warcraft folder. This will create a new directory called "Interface", which will override any built-in user interface. To remove all customized UI, just remove the Interface directory. Be sure that you never remove the Interface directory in Data\, only remove the toplevel Interface directory you created when you unpacked Interface.zip.
When the game is updated, your customized files will not be modified, which means that you'll need to get an updated version of Interface.zip and apply your changes to the new files.
Before you report a bug in the interface, move your custom interface directory out of the way, to make sure the bug occurs in the unmodified game.
XML Layout
The files containing the layout for the game user interface can be found in Interface\FrameXML
The file "FrameXML.toc" contains a list of XML files to load when you enter the game. The files listed are loaded in order. Any errors that occur when loading the files are written to FrameXML.log in the toplevel directory.
Each XML file typically describes one element of UI on the screen. To get a feeling for the syntax, take a look at the files provided. The XML files strictly adhere to the XML 1.0 standard. For those lucky enough to have access to a syntax checker, the file UI.xsd contains the schema used by the WoW interface.
Lua Scripting
All of the functionality in the interface is provided through Lua scripting.
The manual for Lua 5.0 is available online at:
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.
Getting Started
A good place to start getting familiar with the interface is the file BasicControls.xml
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.
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.
How Does It Work?
The very first frame that is created is the WorldFrame. This frame is required, and is where the game world renders. The next frame that is created is the UIParent frame. This frame manages all the rest of the user interface, and allows it to be hidden separately from the world. This is how we get screenshots without the interface visible.
Whenever a frame, texture or fontstring is defined in XML, its initial attributes are defined and it is added to the lua namespace as an object of the appropriate type. Each type of object has member functions that modify that object. This is how we show the error dialog frame from script.
Each frame has a set of script handlers which are called under certain conditions. For example, UIParent has OnLoad, which is called immediately after the frame is loaded, OnEvent, which we'll get to later, OnUpdate, which is called every time the world is updated, and OnShow, which is called whenever the frame is shown.
The OnEvent handler is special. This is the handler that allows the game to communicate with the interface. World of Warcraft is designed so that it needs to know very little about the interface. Instead of calling directly into the interface, whenever something interesting happens, it generates an event. Each frame registers for events that it is interested in, and when those events happen, the OnEvent handler is called for that frame.
Having the UI respond to events wouldn't be very useful if the interface couldn't affect the game in return. The game provides a wide array of functions to query information and change game state. Examples of using these functions are throughout the provided lua files.
Tips and Tricks
World of Warcraft supports dynamically reloading the user interface. At any time you can modify the XML and Lua files and then reload them by bringing down the console (pressing ~) and typing "reloadUI". If there were syntax errors in loading, you can just edit, fix, and reload.
If you're not sure what's happening in the script, use the message() function to print a message and view variables. Once the dialog is shown, your script keeps on executing, but no other message() calls will show anything until you click the button to dismiss the dialog.
Feel free to experiment. If you break something, starting fresh is really easy. If you have questions, look on the forums to see if other people have already figured out the answers. Occasionally, Blizzard staff will be available to answer scripting questions - we value your feedback!
Conclusion
The interface files are provided for your enjoyment, and are not supported in any way. That said, we hope that World of Warcraft provides a robust and flexible system for custom interfaces.