Creating an wow Addon, “Hello World” tutorial

Creating an wow Addon, “Hello World” tutorial

Addons are improving the game’s gameplay, everyone is using at least dbm for raiding, badboy for antispam, and some are have their ui completely changed.

This post will show you how to create an wow addon, without knowing anything about this before.
First thing you need to do is to go into your world of warcraft folder / interface / addons.
You will have there some folders.

Create a new folder: name it “PrettyPls”.
To create an addon you will need 2 files in order to make it really work.
One is a .lua (the programming language the addon is coded in) and one is called .toc (the file that will hold some informations and without him the addon won’t appear in your game login screen on char select).

To create these 2 files just open notepad and save like this:
File > save as > name the file “prettypls” and at save as type select all files and add above at the name of the file .lua.
Do the same thing for the .toc file, instead of lua write toc.

The .toc file:

The .lua file:

The toc file should have these lines:

## Interface: 40000
## Title: Hide
## Notes: It will hide the aspect bar for hunters
## Author: FemaleDwarf.prettypls.com

prettypls.lua

– Interface (the wow version)
– Title (the name of the addon, this will appear on your addon list from char selection in game)
– Notes (just to tell people what the addon does)
– Author (if you want to add your name, notes and author are optional)

– prettypls.lua (will be the file you already created and saved as .lua.

After you created the .toc file go and write in the .lua file:

message (“Hello World”)

save and close.

After this go into the game, login, enable the addon, and when you log into the game you will get this message in a window “Hello World”.

It doesn’t do anything, however is a point where you starting to have fun and have some knowledge about addons.

Now to do some useful stuff for example hide the Hunter class aspect bar (if you are not a clicker you already have binded the aspects on your action bar and that aspect bar is useless covering space).

Write in your .lua file

local EventFrame = CreateFrame(“Frame”)
EventFrame:RegisterEvent(“PLAYER_LOGIN”)
EventFrame:SetScript(“OnEvent”, function(self,event,…)
ShapeshiftBarFrame:HookScript(“OnShow”, function(self) self:Hide()end)

– first line (will create a frame)
– second line (events.. player_login means when you login in the game the written code will be activated)
– third line (set script)
– fourth line (will hide the aspect bar)

Now you can do lots of other stuff, for example add:

DoEmote(“dance”, “target”)
– your char will start to /dance right after you login

CallCompanion(“critter”, 27)
– your char will summon a companion pet (critter = type of pet, 27 – the nr of the pet from your book, you can replace it with 1, the first pet from your list will get summoned.

Now the addons are coded in LUA language, if you really want to study this go here: http://www.lua.org/pil/index.html

A list with all wow events http://wowprogramming.com/docs/events
Also you will find there two books that you can buy from amazon, some addon examples.

Before you go into the code monkey aspect you will need a debugging addon called “Bugsack”, it is free on curse.com

This wow addon tutorial was inspired from http://www.mmo-champion.com/threads/817817-Creating-Your-Own-WoW-Addon
Read there for a better understanding, in this tutorial I mainly tried to explain in detail how to create a simple addon, a “hello world” addon how the coders are calling the first result of their very first try.

You have here Hide the addon that will hide the Hunter aspect bar, just copy it into your wow addons folder.

Have fun coding!

Add a comment: