Quantcast
WoWInterface - View Single Post - GameToolTip Update Event
View Single Post
01-20-21, 03:25 PM   #6
Tranzalore
A Murloc Raider
Join Date: Jan 2021
Posts: 6
Thank you again for your response. It was very helpful.

To start with I changed the code to the following and got things to work.

-- 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:GetScript("OnUpdate")
function ProxyGameToolTipOnUpdate(self, event, ...)
CustomToolTipOnUpdate()
BlizzardGameTooltipOnUpdateRetention(self, event, ...)
end

GameTooltip:SetScript("OnUpdate", ProxyGameToolTipOnUpdate)
I then updated it to the following so it used a secure script like you suggested and it is still working.

-- CreateEvent when GameToolTip Update
local function ToolTipOnUpdate()
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

GameTooltip:HookScript("OnUpdate", ToolTipOnUpdate)
I will go back and update the OnSho and OnHide to use the secure hook as well.

Again thanks alot for you assistance I really apreciated it.
  Reply With Quote