12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1326 Part V ■ AppendixesEntering | into the Chat Edit BoxBecause <strong>World</strong> <strong>of</strong> <strong>Warcraft</strong> uses the | character in its color codes <strong>and</strong>hyperlinks, any that are entered in the edit box are automatically escapedto a double ||. This can be problematic when running Lua scripts with the/script <strong>and</strong> /run comm<strong>and</strong>s. You can substitute the sequence \124 instead <strong>of</strong>the actual character to get around this limitation.‘‘Missing’’ FramesWhen you create a frame in your addon you expect it to be visible. If you can’tfind your frame, it may be missing due to not meeting one <strong>of</strong> the followingrequirements:The frame must have some visual component, such as a texture, backdrop,or text element.The frame must not be set as hidden in the XML file, or the frame’s Show()method must have been called to explicitly show the frame.Each frame that is a parent <strong>of</strong> the frame must also be shown. This includesthe frame’s parent, the parent’s parent, <strong>and</strong> so on.The frame must be anchored somewhere within the bounds <strong>of</strong> the screen.It’s easy to spend time digging through your code only to find later thatyou’ve <strong>for</strong>gotten to place the frame on the screen.Ignoring Logs\FrameXML.logWhen working on XML, there are two places to check to ensure the file is beingparsed <strong>and</strong> validated properly:Load the file in some program that can indicate that the file is well-<strong>for</strong>med.This could include most web browsers or a more complex XML editor/validator.Check the Logs\FrameXML.log file to ensure there weren’t any errorsparsing the file.Not Checking API ReturnsThere are times when the Blizzard API functions may return somethingother than what you’d expect. For example, there’s a small period <strong>of</strong> timewhere UnitClass(unit) can return nil when you’d expect a class name to bereturned. If you use these function returns in some other computation, such asindexing a table or calling another function, you may get an error somewherealong the line.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!