I'm trying to get started with addon development and I'm a little overwhelmed. Ace looks like a great library and I'd prefer to use it over the raw API - I'm trying to - but I have no idea what I'm doing and I can't find any reference material to the Ace API.
OK "no idea" is an exaggeration. I've been writing C++ professionally for 10 years. LUA seems pretty easy to learn and I have no problem with basic LUA.
It's the WoW-specific APIs in LUA that I don't know anything about, both the "raw" API built into the game, as well as the Ace API provided by the Ace libraries.
wowwiki.com seems to be a good reference guide for the built-in raw API provided by Blizzard.
But Ace wraps that API with nicer functions that are meant to be easier to use... other than trying to decipher the Ace source code, and look at examples in existing addons that I use, is there a reference guide somewhere I could use?
I got the AddOn Studio for WoW Visual Studio tool just to use as a LUA editor, and it has a help link to a WoWAce Wiki... unfortunately, it appears that if the WoWAce wiki still exists, it has moved, because that link takes me to the wowace home page where I have not been able to find any links to any wiki or other reference guides specifically about the Ace 3 library functions.
That's the wow API. General advice would say, "Learn to use wow API then use libs".
As for refernce to the Ace3 API stuff, do a SVN check out on the project here. There is a docs file there that has a basic rundown on how things work.
Thanks to your helpful links, I managed to almost finish my new addon, all except for one last problem I'm having: the options (saved variables) get reset to defaults every time I log out and back in.
Here are some code fragments
The first line of the my SpeakinSpell.lua file does this
My OnInitialize function does a bit more than this, but I think this is the only pertinent part of my question
function SpeakinSpell:OnInitialize()
-- Called when the addon is loaded
self:InitSavedVariables() -- set up saved variables data
end
This is all I've done to try to set up saved variables
function SpeakinSpell:InitSavedVariables()
-- register, initialize, and load saved variables
self:RegisterDB("SpeakinSpellDB", "SpeakinSpellDBPerChar")
self:RegisterDefaults('char', DefaultOptions)
end
My default variables end up in self.db.char exactly as intended. As I change the options, I save the new data into self.db.char too.
Is there something I have to do to save/write/flush self.db.char before I logout? Or do I need to change the timing of when I call RegisterDB and RegisterDefaults, based on a different event instead of OnInitialize?
Just curious... Why are you using Ace2 instead of Ace3?
Mostly 2 reasons...
1) all the addons I have, even newly updated ones, and even if they have Ace 3 stuff in their Libs folders, still specify AceWhatever-2.0 in the first line of the file. I have no idea why and I'm mostly learning by example, so it's kind of a result of copy-paste.
2) Wanting to use the latest stuff, I tried to just change that first line to say 3.0, but it wouldn't work, and I got a lot of errors. First :new() is undefined in 3.0. It's NewAddon() now. So I fixed that but then most of the other WowAce functions I was inheriting were either renamed or the parameter lists were changed so I just went back to 2.0 since that's what all my examples use.
That said, I've been thinking today that I use very few WowAce functions, and I'm not trying to do anything particularly difficult or complicated like profile management, so I'm thinking I will ditch all the WowAce stuff out of my addon and write my own functions by hand. Like someone posted above: learn to use the raw API first before learning WowAce.
But still if someone can explain how to do saved variables correctly in either WowAce 2.0 or 3.0 and tell me what step I missed, I'm still curious about that.
Do you have the saved variable set in your toc file? If you look in the saved variables file in the WTF folder for your addon, do you see things being saved? If yes, then you're probably doing something to reassign the default values on next login.
Thanks for your help getting me started everyone. I updated to Ace 3 and solved all the problems that I asked about above. So my first addon is now mostly complete pending some touchups and I plan to release it to the public soon. Keep an eye out for SpeakinSpell (http://www.wowace.com/projects/speakinspell/)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
OK "no idea" is an exaggeration. I've been writing C++ professionally for 10 years. LUA seems pretty easy to learn and I have no problem with basic LUA.
It's the WoW-specific APIs in LUA that I don't know anything about, both the "raw" API built into the game, as well as the Ace API provided by the Ace libraries.
wowwiki.com seems to be a good reference guide for the built-in raw API provided by Blizzard.
But Ace wraps that API with nicer functions that are meant to be easier to use... other than trying to decipher the Ace source code, and look at examples in existing addons that I use, is there a reference guide somewhere I could use?
I got the AddOn Studio for WoW Visual Studio tool just to use as a LUA editor, and it has a help link to a WoWAce Wiki... unfortunately, it appears that if the WoWAce wiki still exists, it has moved, because that link takes me to the wowace home page where I have not been able to find any links to any wiki or other reference guides specifically about the Ace 3 library functions.
Help?
That's the wow API. General advice would say, "Learn to use wow API then use libs".
As for refernce to the Ace3 API stuff, do a SVN check out on the project here. There is a docs file there that has a basic rundown on how things work.
you could check http://www.wowprogramming.com/
http://old.wowace.com/wiki/Category:API_Documentation
For most of the library docs.. might be somewhat out-dated now, but should at least give you some help.
Here are some code fragments
The first line of the my SpeakinSpell.lua file does this
My OnInitialize function does a bit more than this, but I think this is the only pertinent part of my question
This is all I've done to try to set up saved variables
My default variables end up in self.db.char exactly as intended. As I change the options, I save the new data into self.db.char too.
Is there something I have to do to save/write/flush self.db.char before I logout? Or do I need to change the timing of when I call RegisterDB and RegisterDefaults, based on a different event instead of OnInitialize?
1) all the addons I have, even newly updated ones, and even if they have Ace 3 stuff in their Libs folders, still specify AceWhatever-2.0 in the first line of the file. I have no idea why and I'm mostly learning by example, so it's kind of a result of copy-paste.
2) Wanting to use the latest stuff, I tried to just change that first line to say 3.0, but it wouldn't work, and I got a lot of errors. First :new() is undefined in 3.0. It's NewAddon() now. So I fixed that but then most of the other WowAce functions I was inheriting were either renamed or the parameter lists were changed so I just went back to 2.0 since that's what all my examples use.
That said, I've been thinking today that I use very few WowAce functions, and I'm not trying to do anything particularly difficult or complicated like profile management, so I'm thinking I will ditch all the WowAce stuff out of my addon and write my own functions by hand. Like someone posted above: learn to use the raw API first before learning WowAce.
But still if someone can explain how to do saved variables correctly in either WowAce 2.0 or 3.0 and tell me what step I missed, I'm still curious about that.
And, yes, Ace2 is on life-support atm.