Quantcast
Bag issue with Soulbind forge - WoWInterface
Thread Tools Display Modes
08-22-21, 10:27 AM   #1
liquidbase
A Warpwood Thunder Caller
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 97
Bag issue with Soulbind forge

Hey folks!

Currently, I keep getting the following error when opening Soulbind Forge.

Lua Code:
  1. FrameXML\ItemUtil.lua:66: attempt to compare number with nil
  2. Count: 1
  3.  
  4. Call Stack:
  5. [string "=[C]"]: ?
  6. [string "@FrameXML\ItemUtil.lua"]:66: in function `OpenAndFilterBags'
  7. [string "@AddOns\Blizzard_Soulbinds\Blizzard_SoulbindsViewer.lua"]:95: in function <...dOns\Blizzard_Soulbinds\Blizzard_SoulbindsViewer.lua:85>
  8. [string "=[C]"]: in function `Show'
  9. [string "@FrameXML\UIParent.lua"]:2931: in function `SetUIPanel'
  10. [string "@FrameXML\UIParent.lua"]:2753: in function `ShowUIPanel'
  11. [string "@FrameXML\UIParent.lua"]:2644: in function <FrameXML\UIParent.lua:2640>
  12. [string "=[C]"]: in function `SetAttribute'
  13. [string "@FrameXML\UIParent.lua"]:3495: in function `ShowUIPanel'
  14. [string "@AddOns\Blizzard_Soulbinds\Blizzard_SoulbindsViewer.lua"]:197: in function `OpenSoulbind'
  15. [string "@AddOns\Blizzard_Soulbinds\Blizzard_SoulbindsViewer.lua"]:190: in function `Open'
  16. [string "@AddOns\Blizzard_Soulbinds\Blizzard_Soulbinds.lua"]:3: in function `?'
  17. [string "@FrameXML\UIParent.lua"]:2257: in function <FrameXML\UIParent.lua:1288>

But it works fine with the bags and the forge, as you can see on the screenshot.



The script for the bags also contains the events to display the bags correctly when you want to add new conduits at the forge or edit your soulbind (lines 1587, 1588, 1701, 1703).

Script: bags.lua @ DuffedUI

Most likely it will be a simple change, however I am currently stuck. The bug does not interfere or hinder the function. It is only unpleasant when a bug is present.
Maybe someone can tell me where the error is. Passing the functions Stuffing_Open and Stuffing_Close in line 1587 and 1588 to the RegisterEvent did not work.

I thank you in advance for all the input that comes.
  Reply With Quote
08-22-21, 12:38 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 578
DuffedUI replaces OpenAllBagsMatchingContext with an empty function, but the Blizzard UI expects a number returned from that function.

Here's the function called when you open the Soulbind UI:

Lua Code:
  1. function SoulbindViewerMixin:OnShow() -- line 85
  2.     FrameUtil.RegisterFrameForEvents(self, SoulbindViewerEvents);
  3.  
  4.     self:UpdateButtons();
  5.  
  6.     PlaySound(SOUNDKIT.SOULBINDS_OPEN_UI);
  7.    
  8.     self:UpdateBackgrounds();
  9.  
  10.     if C_Soulbinds.CanModifySoulbind() then
  11.         ItemButtonUtil.OpenAndFilterBags(self); -- line 95
  12.     end
  13.  
  14.     self:CheckTutorials();
  15. end

Here's what that function calls to open bags:

Lua Code:
  1. function ItemButtonUtil.OpenAndFilterBags(frame) -- line 62
  2.     ItemButtonUtil.TriggerEvent(ItemButtonUtil.Event.ItemContextChanged);
  3.  
  4.     local openedCount = OpenAllBagsMatchingContext(frame); -- line 65
  5.     frame.closeBagsOnHide = openedCount > 0; -- line 66
  6. end

When OpenAllBagsMatchingContext is called, it goes through the bags and counts which ones are opening:

Lua Code:
  1. function OpenAllBagsMatchingContext(frame)
  2.     local count = 0;
  3.     for i = 0, NUM_BAG_FRAMES do
  4.         if ItemButtonUtil.GetItemContextMatchResultForContainer(i) == ItemButtonUtil.ItemContextMatchResult.Match then
  5.             if not IsBagOpen(i) then
  6.                 OpenBag(i);
  7.                 count = count + 1;
  8.             end
  9.         end
  10.     end
  11.  
  12.     if frame and not FRAME_THAT_OPENED_BAGS then
  13.         FRAME_THAT_OPENED_BAGS = frame:GetName();
  14.     end
  15.  
  16.     return count;
  17. end

The source of the issue is the very last line of the code you linked:
OpenAllBagsMatchingContext = D['Noop']
Based on common code practices, D['Noop'] should be equal to function()end.

This error can be fixed by changing that line to the following:
OpenAllBagsMatchingContext = function() return 0 end
  Reply With Quote
08-22-21, 12:51 PM   #3
liquidbase
A Warpwood Thunder Caller
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 97
Thumbs up

Originally Posted by Kanegasi View Post
The source of the issue is the very last line of the code you linked:
OpenAllBagsMatchingContext = D['Noop']
Based on common code practices, D['Noop'] should be equal to function()end.

This error can be fixed by changing that line to the following:
OpenAllBagsMatchingContext = function() return 0 end
Thanks for pointing me in the right direction and making the appropriate change.
@humfras had also told me that before I saw your posting. I also fixed the other error with D['Noop'], because it is the wrong constant in the UI, correct would have been D['Dummy'].
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Bag issue with Soulbind forge

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off