WoW:Getting started with writing AddOns: Difference between revisions

no edit summary
No edit summary
Line 1: Line 1:
{{uiaddon}}
{{uiaddon}}The following is a guide for getting started with building WoW AddOns. Creating your own AddOns can be a difficult process at first, but can be very satisfying and is a great way to learn programming in general.
The following is a guide for getting started with building WoW AddOns. Creating your own AddOns can be a difficult process at first, but can be very satisfying and is a great way to learn programming in general.


If you are mostly interested in what files and structure comprise a WoW AddOn, you can skip to [[WoW AddOn]], and come back here or move on from there.  
If you are mostly interested in what files and structure comprise a WoW AddOn, you can skip to [[WoW AddOn]], and come back here or move on from there.


== What should I make ==
== What should I make ==
Line 30: Line 29:


== Lua ==
== Lua ==
[[Lua]] is a language used by many games different games for their customizable UI AddOn code and other code. In WoW, if you learn a few Lua basics it will go a very long way to creating your first WoW AddOn, and toward understanding all of the other documentation and help here.
[[Lua]] is a language used by many different games for their customizable UI AddOn code and other code. In WoW, if you learn a few Lua basics it will go a very long way to creating your first WoW AddOn, and toward understanding all of the other documentation and help here.


== World of Warcraft API ==
== World of Warcraft API ==
Line 46: Line 45:
There are three main types of files that you'll need to worry about with AddOn editing:
There are three main types of files that you'll need to worry about with AddOn editing:
* [[TOC File]] - This file is required for any WoW AddOn, and supplies WoW with information about your AddOn and its files.
* [[TOC File]] - This file is required for any WoW AddOn, and supplies WoW with information about your AddOn and its files.
* LUA Files - This contains Lua code for your AddOn.  
* LUA Files - This contains Lua code for your AddOn.
* XML Files - This holds the layout of UI windows, buttons, and similar for your AddOn.
* XML Files - This holds the layout of UI windows, buttons, and similar for your AddOn.


Line 75: Line 74:


=== XML Files ===
=== XML Files ===
XML files are used to specify the visual style of your frames. More importantly though a frame allows you to easily pass events to your Lua files. Check out [[XML User Interface]] for details. Here's a short example of an XML file:
XML files are used to specify the visual style of your frames. More importantly though a frame allows you to easily pass events to your Lua files. Check out [[XML User Interface]] for details. Here's a short example of an XML file:


  <Script file="MyAddon.lua"/>  
  <Script file="MyAddon.lua"/>  
Line 116: Line 115:


== SavedVariables ==
== SavedVariables ==
The [[Saving variables between game sessions]] article covers the key points.   For folks new to AddOns but not other programming languages, just bear in mind that:
The [[Saving variables between game sessions]] article covers the key points. For folks new to AddOns but not other programming languages, just bear in mind that:
* The SavedVariables is only read from on UI loading, not real time, and only saved to on UI unloading. This will generally be from a user logging in or logging out.
* The SavedVariables is only read from on UI loading, not real time, and only saved to on UI unloading. This will generally be from a user logging in or logging out.
* Basically, WoW makes a SavedVariables file for you named after your AddOn. You only get to specify in your TOC *which* variables get saved into that file.
* Basically, WoW makes a SavedVariables file for you named after your AddOn. You only get to specify in your TOC *which* variables get saved into that file.




== Advanced but Important Topics ==  
== Advanced but Important Topics ==


=== Getting the WoW API ===
=== Getting the WoW API ===
After learning all of the basics, there are times where you may want to see how the Blizzard UI code works to help you in making your own AddOn. And getting information on how the WoW UI works can be helpful to making your AddOn function.  
After learning all of the basics, there are times where you may want to see how the Blizzard UI code works to help you in making your own AddOn. And getting information on how the WoW UI works can be helpful to making your AddOn function.


See [[Extracting interface files]] for getting the Blizzard UI AddOn source code which can also be used as a reference.
See [[Extracting interface files]] for getting the Blizzard UI AddOn source code which can also be used as a reference.


=== Localization ===
=== Localization ===
It's a good idea to plan from as early as possible to have your AddOn be localizable, even if you yourself only speak one language. Review this great article for some things to think about: [[HOWTO: Localize an AddOn]].
It's a good idea to plan from as early as possible to have your AddOn be localizable, even if you yourself only speak one language. Review this great article for some things to think about: [[HOWTO: Localize an AddOn]].


== External links ==
== External links ==
Anonymous user