1. I have written Bagbuddy from the book, 2nd version. It is completely the same as the downloadable version for chapter 12 here, which works fine, yet mine won't show. He gives me an error when I give a slashcommand, yet there is not a single difference in the codes.

    What have I done wrong, or has gone wrong?

    What is the error message you get?

    I went through and looked at things, and there are a few outstanding issues due to publication errors in the book, or logic errors for things like heirlooms items. If you take the code from the Chapter 13 page and make the following changes (with which everything appears to work well again):

    In the function BagBuddy_OnLoad

    The filters will not work properly if you have heirloom items, and very few people in WoW have Legendary items. This change maps the sixth button in the row to quality 7, which is the heirloom quality. Alter this portion of the function to look like the following:

       -- Create the filter buttons
       self.filters = {}
       for idx=0,5 do
         local button = CreateFrame("CheckButton", "BagBuddy_Filter" .. idx, self, "BagBuddyFilterTemplate")
         SetItemButtonTexture(button, "Interface\\ICONS\\INV_Misc_Gem_Pearl_03")
         self.filters[idx] = button
         if idx == 0 then
           button:SetPoint("BOTTOMLEFT", 40, 200)
           button:SetPoint("TOPLEFT", self.filters[idx-1], "TOPRIGHT", 12, 0)
         if idx == 5 then
             idx = 7
         button.quality = idx
       self.filters[-1] = self.filters[0]
       self.filters[7] = self.filters[5]

    The changes are right above the button.icon line and the very last line. This checks to see if we're creating the last button, and just changes the idx variable to be 7 instead of 5. We then use a quick mapping from quality to the actual button, same as we've done for -1 quality.

    In BagBuddy_Update

    There's a small logic error here due to the return from GetContainerItemInfo not accurately reflecting the 'quality' of the item. Instead, we use the GetItemInfo function which has more consistent returns. Here is the relevant portion of that function.

       -- Scan through the bag slots, looking for items
       for bag = 0, NUM_BAG_SLOTS do
         for slot = 1, GetContainerNumSlots(bag) do
           local texture, count, locked, qualityBroken, readable, lootable, link = GetContainerItemInfo(bag, slot)
           if texture then
             local name, link, quality = GetItemInfo(link)
             local shown = true
             if BagBuddy.qualityFilter then
               shown = shown and BagBuddy.filters[quality]:GetChecked()
             if #nameFilter > 0 then
               local lowerName = name:lower()
               shown = shown and string.find(lowerName, nameFilter, 1, true)

    The first change is to replace quality with qualityBroken in the call to GetContainerItemInfo. This 'ignores' the value by assigning it to a local variable that is not likely to be used. Then, once we've determined that there is an item in the slot (by checking the texture variable), we fetch the name and the quality of the item using the GetItemInfo function. This saves us a call later when we fetch the name for the name filter, and gets us the quality return we're looking for.

    I hope that all makes sense. I've updated the download for Chapter 13 to reflect the changes.

    However much this will help (and it will, no doubt) My problem is not related to the filtering, or so I think. My problem is more or less concentrated in either the slashcommands, or the OnLoad / OnEvent functions. I've taken everything directly from the downloadable files (which I checked, they work) yet when I login and use /bb or /bagbuddy (the standard slashcommands) I just get: type /help to ..

    WoW doesn't recoqnize my commands, or I have some issue with the summoned functions. However, I cannot find any difference between my files and the given ones on this site. The amount of character's is the same, and as far as I can see (and I've been checking the last two days for it) there is no difference between the files, besides the size (which I think is different because I use Windows, and not Unix)

    I'm not sure which code I should give here, so if you need any to figure this out, ask me for it.

    And I can ofcourse use the codes that are downloadable here, but I'd rather work this out to get a bit more knowledge in the programming of these things. Once I start writing my own add-ons, I cannot simply take someone else's code and use that, as there is no other code.

    Post your code on pastey.net and I'll see if I can find any differences. It's almost certainly a typo somewhere.

    http://pastey.net/137159 = .lua, http://pastey.net/137161 = .toc, and http://pastey.net/137160 = .toc

    Your code is throwing an error due to the full stop on line 57, instead of a comma.

    Ah, I see. And yes, it works now. I'm glad it's no major misunderstanding or something, just a simple typo.

    Now, to the next chapter!