Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Guide for making your own Mods


Admin

Status: Offline
Posts: 60
Date:
Guide for making your own Mods


This is a guide for making your own Mods posted by 'Thundgot' on the official WoW mb:

-------------------------------------------------------------------

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. :)


To start fresh, install the Interface Data and Art into your World of Warcraft folder; this creates a new directory called "Interface". This directory 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 that was created when you installed. (Note: The installer for this will be released shortly, and in the meantime there are several threads which describe how to extract this data manually.)


When the game is updated, your customized files will not be modified, which means that you'll need to reinstall the Interface Data and Art 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 InterfaceFrameXML


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 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 at 1024x768.


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?


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, for example.


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.


Addons


The latest version of World of Warcraft supports an addon structure that allows you to create additions to the user interface without modifying existing interface files.


A good introduction to this feature can be found at:
http://wow.mmhell.com/articles/interface_modification/beginners_guide.html


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 typing: /script ReloadUI(); and hitting enter. 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 in this interface customization forum to see if other people have already figured out the answers, or to post your own questions


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.



-- Edited by Creep at 14:13, 2005-01-24

__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to Del.icio.us


Create your own FREE Forum
Report Abuse
Powered by ActiveBoard