Quantcast
WoWInterface - View Single Post - GameToolTip Update Event
View Single Post
01-19-21, 04:20 PM   #3
Tranzalore
A Murloc Raider
Join Date: Jan 2021
Posts: 6
Thank you for the response LudiusMaximus.

I had tried to hook it instead of override but keept running into errors.

When trying to do this I found this forum post and was basing my code off it. https://forum.elysium-project.org/to...tooltip-event/

So I tried...

-- CreateEvent when GameToolTip Update
function CustomToolTipOnUpdate()
if not (GameTooltipLine1 == GameTooltipTextLeft1:GetText() and GameTooltipLine2 == GameTooltipTextLeft2:GetText() and GameTooltipLine3 == GameTooltipTextLeft3:GetText()) then
if (inDebugMode) then
DEFAULT_CHAT_FRAME:AddMessage("Tooltip OnUpdate Event fired!")
end
GameTooltipLine1 = GameTooltipTextLeft1:GetText()
GameTooltipLine2 = GameTooltipTextLeft2:GetText()
GameTooltipLine3 = GameTooltipTextLeft3:GetText()
GameTooltipChangeHandler()
end
end

local BlizzardGameTooltipOnUpdateRetention = GameTooltip.OnUpdate
function GameTooltip.OnUpdate()
CustomToolTipOnUpdate()
GameTooltip.OnUpdate()
end
This did not trigger the CustomToolTipOnUpdate() function when the GameToolTip was updated. So i tried the following.

-- CreateEvent when GameToolTip Update
function CustomToolTipOnUpdate()
if not (GameTooltipLine1 == GameTooltipTextLeft1:GetText() and GameTooltipLine2 == GameTooltipTextLeft2:GetText() and GameTooltipLine3 == GameTooltipTextLeft3:GetText()) then
if (inDebugMode) then
DEFAULT_CHAT_FRAME:AddMessage("Tooltip OnUpdate Event fired!")
end
GameTooltipLine1 = GameTooltipTextLeft1:GetText()
GameTooltipLine2 = GameTooltipTextLeft2:GetText()
GameTooltipLine3 = GameTooltipTextLeft3:GetText()
GameTooltipChangeHandler()
end
end

local BlizzardGameTooltipOnUpdateRetention = GameTooltip.OnUpdate
function ProxyGameToolTipOnUpdate()
CustomToolTipOnUpdate()
BlizzardGameTooltipOnUpdateRetention()
end

GameTooltip:SetScript("OnUpdate", ProxyGameToolTipOnUpdate)
This did trigger the CustomToolTipOnUpdate() function but throws and error

" Interface\AddOns\ClassicAutoGearChanger\main.lua:334: attempt to call upvalue 'BlizzardGameTooltipOnUpdateRetention' (a nil value)
Time: Wed Jan 20 09:11:12 2021
Count: 1765
Stack: Interface\AddOns\ClassicAutoGearChanger\main.lua:334: attempt to call upvalue 'BlizzardGameTooltipOnUpdateRetention' (a nil value)
[C]: ?
Interface\AddOns\ClassicAutoGearChanger\main.lua:334: in function <Interface\AddOns\ClassicAutoGearChanger\main.lua:332>
[C]: ?
[C]: ?

Locals: "

This makes me think that GameTooltip.OnUpdate does not exist but if it did not exist overriding it should not cause any issues so I am a bit lost.
  Reply With Quote