September 6th, 2009

Creating a Frame in XML can be a long winded process, especially when you see how little it takes to create one using LUA.

Let’s get to it!  Here is a sample LUA showing how to create a Frame:

MyFrame = CreateFrame("Frame","MyFrame",UIParent)
MyFrame:SetPoint("CENTER",0,0)
MyFrame:SetWidth(200)
MyFrame:SetHeight(200)

See how easy that was? What we have done here is created a frame with the name MyFrame and setting its parent to the UIParent.

If your addon isn’t going to hook it to anything else, then it’s best to set the UIParent as the parent frame. After we set its anchor, using the SetPoint function, to the Center with an offset (X & Y) of both 0. We then set the Width and Height both to 200. Now you wont actually see anything as we haven’t changed any colours or set any textures, but the frame will be there.

Read the rest of this entry »

May 9th, 2009

After taking a break from making addons and recently coming back to it, I had trouble even following my own previous tutorial.  So this time around I want to show how a simple lua file can bring an addon to life.

To start off with we are going to look at saved variables and how to load them up.

Note: A saved variable is a table which can contain many variables in a tree-like design.

Ok, let’s move on.  When WoW loads, the addons are loaded first, then the saved variables, this creates a small problem… Your saved data isn’t available at the time your code runs.  We get around this by hooking the event VARIABLES_LOADED.

Read the rest of this entry »

April 14th, 2009

Seeing as patch 3.1 is being released today I thought I would mark this occasion with a small tutorial on creating images for your addons.

For this tutorial I will be using Photoshop, but if you know your way around your favourite image editing program it shouldn’t make much of a difference.

First off, you need to remember a small simple rule.  The image size must always be a multiple of 8, otherwise your image wont show up (correct me if I’m wrong in a comment, but it has never worked for me with any other number that isn’t a multiple of 8).  What does that mean ? Well, basically your image should have one of the following dimensions:
8×8
16×16
32×32
64×64
128×128
And so on…

Read the rest of this entry »

September 18th, 2008

This post is really just to tie all the tutorials/walkthroughs together for getting to grips with creating a WoW addon.

I’m hopeing I explained everything clear enough to help out and if no then just drop a comment and I will see what I can do.  For now hit up the following links depending on what you want to know! Enjoy!

Just remember learning something new isn’t always easy and I would recommend knowing some sort of coding before hand (xml & lua/javascript would help)

The Basics – File Structure

The Basics – The .toc File

The Basics – The .xml File

The Basics – XML Buttons, Labels & Layers

The Basics – The .lua File

Useful Links

Lua.Org
WoWWiki Api Page

September 17th, 2008

Please also see my recent post on LUA basics and loading saved variables which can be found Here!

Time to start coding eh? Ok well welcome to the LUA code introduction.

This is where your addon really comes to life and ties in with the XML file.  In the XML file tutorial we touched on the scripts tag and we sent everything to a function to deal with the events.

So what is the LUA file and what is it for you ask?  The LUA file is where the meat of the code lives and hold most of your functions and what not for your addon.  When a event happens we usually call a function to determine what has happened and then call the appropriate function within the LUA file.

First of all you need to register your addon with specific events.  We normally do this using an OnLoad function where we setup the addon.  Here is the HonorSpy OnLoad function:

function HS_OnLoad()
SlashCmdList["HS"] = HSCmdLine;
SLASH_HS1 = “/hs”;
this:RegisterEvent(“VARIABLES_LOADED”);
this:RegisterEvent(“CHAT_MSG_COMBAT_HONOR_GAIN”);
this:RegisterEvent(“PLAYER_PVP_KILLS_CHANGED”);
this:RegisterEvent(“PLAYER_ENTERING_WORLD”);

DEFAULT_CHAT_FRAME:AddMessage(“HonorSpy Loaded.”);
end

Read the rest of this entry »

September 10th, 2008

So you have a form which looks all nice but it’s a little boring unless we stuff something on it right ?  Ok so lets start with adding a button.  To do this we use the following:

<Frames>
<Button name=”MYButton” inherits=”UIPanelButtonTemplate” text=”Close”>
<Size>
<AbsDimension x=”80″ y=”22″/>
</Size>
<Anchors>
<Anchor point=”BOTTOMLEFT” relativeTo=”HSFrame”>
<Offset>
<AbsDimension x=”15″ y=”10″/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>HSFrame:Hide();</OnClick>
</Scripts>
</Button>
</Frames>

Read the rest of this entry »

September 9th, 2008

Now you know where files go and what the .toc file is all about it’s time to look at the XML file.  This is where we are going to design how our addon is going to look and tell WoW where to show it etc.

If your new to XML it’s alot like HTML where elements are referenced by tags (a tag being a name inside <> for example: <frame>)

So at the very top of the XML file we will have the follow UI tag to open with

Read the rest of this entry »

September 9th, 2008

Now we know what files are needed lets look at the .toc file and what goes in there.

First of all lets take a look at the HonorSpy.toc file

## Interface: 20400
## Title: HonorSpy
## Notes: Keeps tabs on all your honor and kills.  On all characters!
## Author: Shooshting
## SavedVariables: HonorSpy
HonorSpy.xml

Read the rest of this entry »

September 9th, 2008

Hello and welcome to The Basics!  First off the reason im putting this together is so that others like myself who are quite new to the whole addon creation process and had trouble figuring out what does what and what goes where from all over the interwebs.

Ok so lets get in to it.

You should figure out the name of your addon as this will also be the basis of your file structure.  To help along the way will shall use my recent addon as a example HonorSpy.

Read the rest of this entry »