Thread Tools Display Modes
01-30-23, 09:12 AM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 122
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)
  Reply With Quote
01-30-23, 03:43 PM   #2
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 122
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?

Last edited by Benalish : 01-30-23 at 06:08 PM.
  Reply With Quote
01-31-23, 12:16 AM   #3
ludwici
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2023
Posts: 4
Originally Posted by Benalish View Post
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...
__________________
Dragonflight minimap on classic versions: DFMinimap (curse) or DFMinimap


Displays in which expansion the item was added: Itemansion (curse) or Itemansion
  Reply With Quote
02-06-23, 06:22 AM   #4
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 122
Originally Posted by ludwici View Post
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!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Getting GameTooltip:GetItem()

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off