New PlayerScore 4.4

UI Mod Guide - Appendix 1

Updated Thu, Feb 21, 2008 by bpirkle

Krimm's Guide
to World of Warcraft Addon Design

Appendix 1
Debugging


There is much that can go astray when working with AddOns.  Unfortunately the error messages provided by WoW aren’t always helpful.  Here are a few tips to troubleshooting AddOns:

- Watch out for version changes.  Remember that the .toc file has the expected version of WoW at the top.  This must match the actual version of WoW for your AddOn to load.  Be sure that when WoW upgrades, you adjust the version number in your .toc file.  Here’s an article on getting the version number:  http://www.wowwiki.com/HOWTO:_Get_Current_Interface_Number
Simpler is to find the version number from another AddOn’s .toc file.  Also, you can just ask in the forums on this site.

- Check your names carefully.  Case matters.  Underscores matter.  The names “MyAddOn”, “MyAddon”, and “My_AddOn” are all different.

- Watch out for smart quotations.  Many editors and word processors (such as Microsoft Word) like to replace normal quotation marks with “smart quotes”.  In virtually all cases, you’ll want normal quotation marks.  These tend to be displayed as two parallel lines running straight up and down, while smart quotes tend to be angled and sometimes curved.

- Make sure there are no spaces after “.xml” in your .toc files.  If there are, WoW will consider the spaces to be part of the file name.  This will cause WoW to fail to find the XML file, preventing your AddOn from running. 

- Make sure to initialize all variables with safe default values.  Even if you expect to normally use a saved value, you can’t count on it.  The first time your AddOn runs, there won’t be anything saved.  And the user could always have deleted the saved variables file.  Safe defaults eliminate a whole category of tricky bugs.

- Write lots of comments.  If your code isn’t working, you’ll often find that improving the comments causes you to realize what is wrong.  But looking at this the other way, don’t assume just because a comment says your code does something, that the code actually does it.  Sometimes you’ll find that what your comments say happens and what really happens are entirely different things.

- Keep your XML and Lua separate.  If you’re having problems and you’ve let Lua creep into your XML, try cleaning things up.  You may run across the source of the problem in the process.

- Watch out for old “saved variable” values.  If you already have a saved variable value stored for your AddOn and you change assumptions about that data, or if a buggy version of your AddOn stored bad data, you can run into trouble.  You can remove these by hand (see the sections in this guide on saved variables for details on where these values are stored). 

- As with many programming languages, the line number reported in an error message isn’t necessarily the line containing the actual error.

- If you can’t figure it out, ask.  The many different WoW forums are great sources of information.  You’ll often find helpful people willing to answer your questions.  If you’re not sure where to ask, the forums on wow.tentonhammer.com are a great place to start. 

Go to Appendix 2 - Links and Credits!

Skill + Stats = PlayerScore.  Click here to find out where you rank!
LOTRO Screenshot
Wanting something to do while your server is down for maintenance? Check out these five subscription-free MMOs, sure to keep you from entering WoW withdraw.
Features
Mon, Feb 13, 2012
Mem
Mists of Pandaria -- Pandaren Monk Striking Target Dummy

There have been many rumblings from Blizzard fans that don't really want Mists of Pandaria as the next (or any expansion) and ask the question "Why Mop?"

Features, Opinions
Mon, Feb 13, 2012
Messiah
d3ce.jpg
Mists of Pandaria's launch could happen by the end of the year so what better time to look at what the Collector's Edition could contain?
Features, Opinions
Fri, Feb 10, 2012
Saia
photo.JPG

I finally got myself a Razor Naga (Molten Edition)!

About a year ago, I really wanted a naga mouse for my birthday. However, my girlfriend goes to BestBuy and the jerk working there tells her that I wouldn't like the naga because its too hard to push the buttons on the side. He told her to get me the World of Warcraft mouse (Cataclysm Edition).

Blogs
Wed, Feb 08, 2012
Arxkanite
Become a Premium Member

News from around the 'Net