-
Posted by frazeebd on Fri, 02 Jul 2010 01:56:13
So, I bought the book recently and have been doing BagBuddy. I was away from home for a few days, so I wasn't able to test anything, but was following along with the book and writing all my code in notepad. Got home today and tried to load my addon thus far.
The BagBuddy addon does show successfully in the addons list, and I can enable it. I enter the game world... and it isn't there. Nor can I figure out how it is supposed to show at all. There are no error messages or anything.
It's not 100% done, but along the way it should be testable from what I read.
Here is my code so far.. I'm done up to the part about creating name filters, thats the next step, but I must have an issue somewhere and I'm having a hell of a time finding it. What part of this actually displays the BagBuddy window?
Here is my code:
LUA: http://www.pastey.net/138210-358u
XML: http://www.pastey.net/138211
I tried copying my TOC file to this post, but it doesn't paste correctly into this window, the "##" keep making all kinds of wierd font changes, so I didn't post it here but its the simple, standard thing.. don't think there's anything wrong there.
-
Posted by jnwhiteh on Fri, 02 Jul 2010 09:08:11
The first thing I see is that you're using commas in some of your XML lines, for example $parentTitle. These will cause parsing errors of the XML file and will be listed in your Logs\FrameXML.log file.
-
Posted by frazeebd on Fri, 02 Jul 2010 15:40:20
Ah, indeed I did, in line 77. Must have been switching between XML and LUA and had a brain fudge. I will try loading it again tonight.
As far as loading the program.. The Scripts section in the XML file which is set to OnEnable, that script fires when the character enters the game world and the addon is enabled?
-
Posted by jnwhiteh on Fri, 02 Jul 2010 15:55:41
Ah, indeed I did, in line 77. Must have been switching between XML and LUA and had a brain fudge. I will try loading it again tonight.
As far as loading the program.. The Scripts section in the XML file which is set to OnEnable, that script fires when the character enters the game world and the addon is enabled?
I don't see a section that's 'OnEnable', perhaps I missed something?
-
Posted by frazeebd on Fri, 02 Jul 2010 19:41:47
Yikes, I misspoke. I was reading some other code examples at the time I posted.
In the XML file, there is a scripts subsection of the main BagBuddy frame with an OnLoad item that calls the BagBuddy_OnLoad function in the LUA. I assume this script fires when the BagBuddy frame is "loaded" by the UIParent. Is "OnLoad" related to hidden/visible status, or is it just related to the addon being enabled in the UI?
Also, what causes the BagBuddy frame to show in the first place? I can't imagine it shows by default simply because it is defined, but I can't figure out what instructs the game client to show that frame initially when the character enters the game world. I downloaded a "finished" version of BagBuddy from a WoW addon site, and read through the final version... I see where the slash commands get created for loading the frame... but what would cause it to show in my case, since I haven't gotten that far yet?
-
Posted by jnwhiteh on Fri, 02 Jul 2010 23:40:59
Yikes, I misspoke. I was reading some other code examples at the time I posted.
In the XML file, there is a scripts subsection of the main BagBuddy frame with an OnLoad item that calls the BagBuddy_OnLoad function in the LUA. I assume this script fires when the BagBuddy frame is "loaded" by the UIParent. Is "OnLoad" related to hidden/visible status, or is it just related to the addon being enabled in the UI?
OnLoad is just fired during the initialization of a frame. If you create a template that has a single OnLoad script and then later create a frame from that template, it will fire during/after the CreateFrame() call. If you're making the frame entirely in XML, it will fire as the frame is processed and created.
Its not related to hidden or visible status, and is also not really related to the addon being enabled (other than the frame will never be created if the addon isn't enabled).
Also, what causes the BagBuddy frame to show in the first place? I can't imagine it shows by default simply because it is defined, but I can't figure out what instructs the game client to show that frame initially when the character enters the game world. I downloaded a "finished" version of BagBuddy from a WoW addon site, and read through the final version... I see where the slash commands get created for loading the frame... but what would cause it to show in my case, since I haven't gotten that far yet?
All frames are shown by default unless you set hidden="true" in the XML definition, or explicitly hide it. The difference in the initial versions that you're working on is that the early versions don't set this flag, and the later versions do.