I'm trying to get information about equipped items via GameTooltip, so I have this code in the event handler frame (I know I should use my own scan tooltip for this, and I do, but for this it doesn't matter):
Code:
if event == "PLAYER_ENTERING_WORLD" then
local iLink = GetInventoryItemLink("player", 16)
print(iLink, gsub(iLink, "\124", "\124\124"))
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:SetHyperlink(iLink)
GameTooltip:Show()
print(GameTooltip:NumLines())
return
end
When I print iLink - it's missing item color, it's always "ffffff" and the name, it's empty "[]". GameTooltip come up saying "Requires item information", so I get NumLines = 1 and then quickly updates itself with the right item info.
If I execute the same code 1 sec after PLAYER_ENTERING_WORLD it works fine, iLink is not broken.
Is there any event that I can use to make sure at this time GetInventoryItemLink will work?
I tried UNIT_INVENTORY_CHANGED but it fires 112 times in a row after each PLAYER_ENTERING_WORLD so it's not really helpful.
Thanks,