WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Getting GameTooltip:GetItem() (https://www.wowinterface.com/forums/showthread.php?t=59494)

Benalish 01-30-23 09:12 AM

Getting GameTooltip:GetItem()
 
There's a way to get GameTooltip:GetItem() when GameTooltip is hidden? I know the GameTooltip tries to show when mouse hovers a game object, so I tried this script, but it doesn't seem to work

Lua Code:
  1. GameTooltip:HookScript('OnShow', function(self)
  2.     print(self:GetItem())
  3. end)

Benalish 01-30-23 03:43 PM

I made this script working when GameTooltip is hidden:

Lua Code:
  1. GameTooltip:HookScript('OnTooltipSetItem', function(self)
  2.     print(self:GetItem())
  3. end)

However this script stop to work when the GameTooltip is hidden due to a conflict with another addon.
Is there any way to protect my script from future conflicts like this?

ludwici 01-31-23 12:16 AM

Quote:

Originally Posted by Benalish (Post 342094)
However this script stop to work when the GameTooltip is hidden due to a conflict with another addon.

What about using AceHook? It allows you to make a safe hook without conflicts
Or you can save you item to another variable

Lua Code:
  1. GameTooltip:HookScript('OnShow', function(self)
  2.     myItemVar = self:GetItem()
  3. end)

If I understand your idea correctly...

Benalish 02-06-23 06:22 AM

Quote:

Originally Posted by ludwici (Post 342102)
What about using AceHook? It allows you to make a safe hook without conflicts
Or you can save you item to another variable

This is what I was looking for! Thank you!


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

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