I'm new to the whole Addon makeing thingy. I'm so new that i haven't even got started yet, because i keep asking myself some question that i would like to answered now.
First of all, I started looking at the WoWWiki's way of makeing addons. And all that looked good and i downloaded blizzard's own thing too, where there was some tutorials and explames, all very good. Then i thought of Ace, What is Ace? Something else proviede to make Addons? To make it all easier? Seen alot Addons nowadays where Ace is needed and used, so that makes me wonder if that's difttent from the WoWiki way..
Secound, First i thought Notepad was good enough for it, but then i thought that there might be any better ones out their, anyone know some of them? if they are there ^^
Some of it may seems like stupid and dumb things to ask about, but i just wanna know before i begin my adventure into the jungle of LUA, XML and such.. ^^
What is Ace? Something else proviede to make Addons? To make it all easier?
The second. It's a collection of libraries (reusable, sharable chunks of software) designed to ease repetitive tasks. If you use any Ace libs, you really, really, really want to stick to Ace3 and not Ace2.
Secound, First i thought Notepad was good enough for it, but then i thought that there might be any better ones out their, anyone know some of them? if they are there ^^
Search these forums for "Lua text editors" and take your pick. There's also a thread over in the Lua coding forum about development/test environments that might be of interest to you. I'd recommend grabbing the WowLua addon, so you can do simple in-game editing and testing of code snippets.
Also, read sticky threads. Lots of sticky threads. Here, at the Blizz UI forum
, and at Wowinterface. They're stickied for a reason and will help you avoid lots of beginner's mistakes. (Or at least make those mistakes more memorable!)
The second. It's a collection of libraries (reusable, sharable chunks of software) designed to ease repetitive tasks. If you use any Ace libs, you really, really, really want to stick to Ace3 and not Ace2.
Could you explain the meaning of the word "libraries" and more of such?
Google is your friend. Or, visit any nearby bookstores or university libraries, and look for books on introductory computer science. The descriptions of the Ace3 projects themselves (here) will also be good examples.
Secound, First i thought Notepad was good enough for it, but then i thought that there might be any better ones out their, anyone know some of them? if they are there ^^
Some of it may seems like stupid and dumb things to ask about, but i just wanna know before i begin my adventure into the jungle of LUA, XML and such.. ^^
Don't use XML for frames. You're better off (my opinion) just doing them in LUA as you have far more control over everything.
I got started (carefully admitting that I still have a great deal to learn) by reading the stickied posts mentioned above, and I also bought Cladhaire/James Whitehead II & Matthew "Ace" Orlando's book "World of Warcraft Programming." It is a bit dated, since it was written for version 2.3 of the game, but all the principles still apply.
I understand Mssrs Whitehead and Orlando will be writing a second edition, but don't wait for it it is a long way off.
Hi I just started as well, and maybe we can benefit from each others learnings... maybe :)
Anyways, here is what I'm doing.
I'm using Notepad++ as my editor.
My addon will be named Vampyr - vampire in danish. It's going to add some flavor to my guilds play, giving humorous reminders for vampires.
As I start to write my addon I'm going to make mistakes and syntax errors. Having to start wow over every time I make a code change will be a hassel, and I hope to get some improved debugging help using Ace3. Perhaps even be able to reload the addon while wow is running. Can I do that?
CODE:
My first code will be in three files and a sub folder with libraries.
Vampyr.toc, main.xml and main.lua
No effect. I was hopping to see: Hello, world!
in the chat window.
I'm guessing OnInitialize() happens to early, and that maybe the chat window isn't ready at that time.
No, the chat window is ready when your addon is loaded.
You should take care about the order of the files listed in your TOC. They will be loaded in the order you specify. For instance, you put "embeds.xml" after your "main.lua", so if your addon is the first to try to load Ace3, then wow will try to load "main.lua" before Ace3 is available and your first line will fail.
You really should make sure that your system is set up so that you can get lua error reported, with a traceback. Get BugSack (and !Buggrabber), for instance. You should get an error message that will help you correct your problem.
As I start to write my addon I'm going to make mistakes and syntax errors. Having to start wow over every time I make a code change will be a hassel, and I hope to get some improved debugging help using Ace3. Perhaps even be able to reload the addon while wow is running. Can I do that?
Depends on the kind of code change.
The .toc file is read when the client starts. Changing that (new files, removed files, different order, changes to X-* fields, etc) requires a game restart.
Everything else (the *contents* of .xml/.lua files) is read when a character enters the world. If your addon does anything tricky at load/login time, you'll find yourself parked in a capital or inn someplace, logging out and back in over and over. Most addons don't need to be so cautious about the exact login events, and you can simply use "/script ReloadUI()" to speed up logout+login. Those events won't be *exactly* the same, but most of the time that won't matter. (Ace and several other libraries wrap that in a slash command, /reloadui or /rl.)
DThe .toc file is read when the client starts. Changing that (new files, removed files, different order, changes to X-* fields, etc) requires a game restart.
That's not exactly true. The list of files available in the Interface folder (or any folder) is read only once when the game is started. You can add and remove entries to the TOC at runtime and have it effect the next UI reload, but you can't add a new file to the folder and expect it to be read after a reload. Adding a file that existed at the time you started the game is fine.
If you make the addon folder ahead of time and you know you'll need several files make them before starting WoW so you don't have to restart so many times. (Even if they're blank for 45 minutes while you write it)
Its generally easier to make addons in WoW itself. Pick up the addon 'WoWLua' to design LUA code in game. I personally have eight addons completely finished all in LUA that i've never actually ported out of WoWLua.
Pick up a debugger-- BugSack or Swatter will help you more than you can imagine.
You might also want a 'developer' addon. I personally use _Dev. It allows you to make a dump of tables, frames, and other datasets that can be hard to debug.
Thx jerry - very helpful. I now have bugbag and !buggrabber.
After correcting the order of embed.xml and main.luz in vampyr.toc I get this error from bugbag:
2009/03/31 19:52:12-1-x1]: Vampyr-0.1\main.lua:7: attempt to call method 'Print' (a nil value)
(tail call): ?:
<in C code>: ?
<string>:"safecall Dispatcher[1]":9: in function <[string "safecall Dispatcher[1]"]:5>
(tail call): ?:
AceAddon-3.0-5 (BugSack):340: in function `InitializeAddon'
AceAddon-3.0-5 (BugSack):428: in function <...ce\AddOns\BugSack\Libs\AceAddon-3.0\AceAddon-3.0.lua:421>
so maybe I didn't mixin the library with the Print("string") function. I'll have to check on that now.
Edit: yes, it works with this line instead:
MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceConsole-3.0")
I got started (carefully admitting that I still have a great deal to learn) by reading the stickied posts mentioned above, and I also bought Cladhaire/James Whitehead II & Matthew "Ace" Orlando's book "World of Warcraft Programming." It is a bit dated, since it was written for version 2.3 of the game, but all the principles still apply.
I understand Mssrs Whitehead and Orlando will be writing a second edition, but don't wait for it it is a long way off.
Amazon has it dated to come out at the end of July of this year. I want to get the book but I'll probably wait for the 2nd edition since I haven't gotten around to it yet.
It also struck me as odd that it looks like it goes in-depth into making frames via XML when noone does it that way any more. I the book dovetails it well into the subject of doing it via Lua instead.
This morning I read through: http://old.wowace.com/wiki/WelcomeHome_-_Your_first_Ace3_Addon. It has a lot of info for me at this point on my learning curve. One thing I would like to know more about is user interface. The addon in the mentioned article uses UIErrorsFrame to display a message.
Does Ace3 have a UI library I should use, or maybe someone can guide me to another article about making a UI and hooking it with my addon code?
To begin with I'm just going to have an area for text output and a few buttons. Later on I'll have a bar to be filled up from the buttom: The more mobs killed, the more blood in the bar.
Also, I read a bit about unitframes. It seems that the projects I came across are ment to replace blizzards UI. But I just need to add a little, so instead of digging to deep into those projects I ask here.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
First of all, I started looking at the WoWWiki's way of makeing addons. And all that looked good and i downloaded blizzard's own thing too, where there was some tutorials and explames, all very good. Then i thought of Ace, What is Ace? Something else proviede to make Addons? To make it all easier? Seen alot Addons nowadays where Ace is needed and used, so that makes me wonder if that's difttent from the WoWiki way..
Secound, First i thought Notepad was good enough for it, but then i thought that there might be any better ones out their, anyone know some of them? if they are there ^^
Some of it may seems like stupid and dumb things to ask about, but i just wanna know before i begin my adventure into the jungle of LUA, XML and such.. ^^
Thanks on forehand
The second. It's a collection of libraries (reusable, sharable chunks of software) designed to ease repetitive tasks. If you use any Ace libs, you really, really, really want to stick to Ace3 and not Ace2.
Search these forums for "Lua text editors" and take your pick. There's also a thread over in the Lua coding forum about development/test environments that might be of interest to you. I'd recommend grabbing the WowLua addon, so you can do simple in-game editing and testing of code snippets.
, and at Wowinterface. They're stickied for a reason and will help you avoid lots of beginner's mistakes. (Or at least make those mistakes more memorable!)
http://forums.worldofwarcraft.com/board.html?forumId=11114&sid=1
Could you explain the meaning of the word "libraries" and more of such?
Google is your friend. Or, visit any nearby bookstores or university libraries, and look for books on introductory computer science. The descriptions of the Ace3 projects themselves (here) will also be good examples.
Notepad++. Free code editor, works great.
Don't use XML for frames. You're better off (my opinion) just doing them in LUA as you have far more control over everything.
I understand Mssrs Whitehead and Orlando will be writing a second edition, but don't wait for it it is a long way off.
Anyways, here is what I'm doing.
I'm using Notepad++ as my editor.
My addon will be named Vampyr - vampire in danish. It's going to add some flavor to my guilds play, giving humorous reminders for vampires.
As I start to write my addon I'm going to make mistakes and syntax errors. Having to start wow over every time I make a code change will be a hassel, and I hope to get some improved debugging help using Ace3. Perhaps even be able to reload the addon while wow is running. Can I do that?
CODE:
My first code will be in three files and a sub folder with libraries.
Vampyr.toc, main.xml and main.lua
Vampyr.toc:
## Interface: 30000
## Title: Vampyre
## Notes: Vampire addon
## Author: Gretter1
## Version: 0.1
embeds.xml:
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Script file="Libs\LibStub\LibStub.lua"/>
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
</Ui>
main.lua:
MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon")
function MyAddon:OnInitialize()
-- Code that you want to run when the addon is first loaded goes here.
-- AceConsole used as a mixin for AceAddon
MyAddon:Print("Hello, world!")
end
function MyAddon:OnEnable()
-- Called when the addon is enabled
end
function MyAddon:OnDisable()
-- Called when the addon is disabled
end
And now I'll go try it out... see if it does anything.
btw. The code I got from here:
http://www.wowace.com/projects/ace3/pages/getting-started/
oh.. and in the Libs folder are alle the files form the latest ace3 beta release.
in the chat window.
I'm guessing OnInitialize() happens to early, and that maybe the chat window isn't ready at that time.
You should take care about the order of the files listed in your TOC. They will be loaded in the order you specify. For instance, you put "embeds.xml" after your "main.lua", so if your addon is the first to try to load Ace3, then wow will try to load "main.lua" before Ace3 is available and your first line will fail.
You really should make sure that your system is set up so that you can get lua error reported, with a traceback. Get BugSack (and !Buggrabber), for instance. You should get an error message that will help you correct your problem.
Depends on the kind of code change.
The .toc file is read when the client starts. Changing that (new files, removed files, different order, changes to X-* fields, etc) requires a game restart.
Everything else (the *contents* of .xml/.lua files) is read when a character enters the world. If your addon does anything tricky at load/login time, you'll find yourself parked in a capital or inn someplace, logging out and back in over and over. Most addons don't need to be so cautious about the exact login events, and you can simply use "/script ReloadUI()" to speed up logout+login. Those events won't be *exactly* the same, but most of the time that won't matter. (Ace and several other libraries wrap that in a slash command, /reloadui or /rl.)
If main.xml isn't listed in the .toc file, it won't be loaded. Since your main.xml doesn't do anything in this example, you can get rid of it.
That's not exactly true. The list of files available in the Interface folder (or any folder) is read only once when the game is started. You can add and remove entries to the TOC at runtime and have it effect the next UI reload, but you can't add a new file to the folder and expect it to be read after a reload. Adding a file that existed at the time you started the game is fine.
After correcting the order of embed.xml and main.luz in vampyr.toc I get this error from bugbag:
2009/03/31 19:52:12-1-x1]: Vampyr-0.1\main.lua:7: attempt to call method 'Print' (a nil value)
(tail call): ?:
<in C code>: ?
<string>:"safecall Dispatcher[1]":9: in function <[string "safecall Dispatcher[1]"]:5>
(tail call): ?:
AceAddon-3.0-5 (BugSack):340: in function `InitializeAddon'
AceAddon-3.0-5 (BugSack):428: in function <...ce\AddOns\BugSack\Libs\AceAddon-3.0\AceAddon-3.0.lua:421>
so maybe I didn't mixin the library with the Print("string") function. I'll have to check on that now.
Edit: yes, it works with this line instead:
MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceConsole-3.0")
Thx. I've corrected that in my initial post. main.xml is not used just embed.xml
Amazon has it dated to come out at the end of July of this year. I want to get the book but I'll probably wait for the 2nd edition since I haven't gotten around to it yet.
It also struck me as odd that it looks like it goes in-depth into making frames via XML when noone does it that way any more. I the book dovetails it well into the subject of doing it via Lua instead.
Huh, never suspected that. Figured .toc was a one-shot. Thanks for the details!
Does Ace3 have a UI library I should use, or maybe someone can guide me to another article about making a UI and hooking it with my addon code?
To begin with I'm just going to have an area for text output and a few buttons. Later on I'll have a bar to be filled up from the buttom: The more mobs killed, the more blood in the bar.
Also, I read a bit about unitframes. It seems that the projects I came across are ment to replace blizzards UI. But I just need to add a little, so instead of digging to deep into those projects I ask here.