Alright, with that extra check everything seems to work now. I've added a simple check for the bank too and it all seems to be going nice and smooth, but I'll let you know if it still messes up.
This is what it now looks like:
Code:
function CheckSlots()
if GetContainerNumSlots(4) == 0 then
if GetContainerNumSlots(3) == 0 then
if GetContainerNumSlots(2) == 0 then
if GetContainerNumSlots(1) == 0 then
NUMBAGS = 1
else
NUMBAGS = 2
end
else
NUMBAGS = 3
end
else
NUMBAGS = 4
end
else
NUMBAGS = 5
end
end
function CheckBankSlots()
NUMBANKBAGS = GetNumBankSlots() + 1
end
local f = CreateFrame("Frame")
f:SetScript("OnEvent", CheckSlots)
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("BAG_UPDATE")
f:RegisterEvent("VARIABLES_LOADED")
local g = CreateFrame("Frame")
g:SetScript("OnEvent", CheckBankSlots)
g:RegisterEvent("PLAYER_LOGIN")
g:RegisterEvent("PLAYER_ENTERING_WORLD")
g:RegisterEvent("BAG_UPDATE")
g:RegisterEvent("VARIABLES_LOADED")
CheckSlots()
Going to do some cleaning up when I see that everything works fine after a while of using it. I don't really need the two frames either.