WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   I need some help with 1.9 changes (https://www.wowinterface.com/forums/showthread.php?t=2495)

Phoenix 11-25-05 07:21 AM

I need some help with 1.9 changes
 
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?

thx

Phoenix 11-28-05 04:20 AM

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?

Gello 11-28-05 10:37 AM

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.

Phoenix 11-28-05 11:04 AM

That solved the problem :) Thx very much m8 :D

Gello 11-28-05 11:48 AM

Oh from http://forums.worldofwarcraft.com/th...p=1#post270816

Quote:

* 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)

Phoenix 11-28-05 12:16 PM

Looks better to use that one yes. Well thx again :) Nice link too btw.


All times are GMT -6. The time now is 10:41 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI