Hi
I made a small addon for myself that tracks the number of the X item I have in my inventory. I recently tested it on the testrealms and it doesn't work anymore. So I'm wondering. How do I get the count of the X item and return it to a text after 1.9?
function UpdateTest()
local TestR = 0;
local TestRI = 0;
local tooltip = getglobal("TestTooltip");
for bag=4, 0, -1 do
local size = GetContainerNumSlots(bag);
if (size > 0) then
for slot=1, size, 1 do
local texture, itemCount = GetContainerItemInfo(bag, slot);
if (itemCount) then
local itemName = nil;
tooltip:SetBagItem(bag, slot);
local ttext = getglobal("TestTextLeft1");
if (ttext and ttext:IsVisible() and ttext:GetText() ~= nil)
then
itemName = ttext:GetText();
if (itemName ~= nil and itemName == ( R1 ) and
UnitLevel("Player")>50 and UnitLevel("Player")<60) then
TestR = Test+ itemCount;
TestText:SetText(TestR);
That is a basic view of how my code looks like right now. Anyone have a idea why that won't work on the test realm?
Total shot in the dark but try adding the line in bold:
if (itemCount) then
local itemName = nil; tooltip:SetOwner(this)
tooltip:SetBagItem(bag, slot);
local ttext = getglobal("TestTextLeft1");
I didn't follow the discussion on IRC but I seem to recall something about tooltips not working well if a SetOwner didn't work, or something like that. IsVisible was mentioned in there also. Sorry that's not much information.
* NEW - isShown = FontString:IsShown() - Return whether font string is shown (NOTE: FontString IsVisible behaves properly now on hidden tooltips, tooltip scanners need to use IsShown instead !)
Take out the SetOwner and try using IsShown instead of IsVisible.
I think that's the more correct fix than setting owner (which has a SetPoint and stuff involved which can make the process take longer)