OnTooltipSetItem

Error
Message: …s/Bagnon/common/Wildpants/features/tooltipCounts.lua:34: QuickKeybindTooltip doesn’t have a “OnTooltipSetItem” script

Anyone know what I can use to replace this? Or just comment it out?

OnTooltipSetItem handler was removed. You want to set up callbacks now:

You want to use TooltipDataProcessor.AddTooltipPostCall now.

local function OnTooltipSetItem(tooltip, data)
    print("OnTooltipSetItem", tooltip, data)
end

-- Replace 'Enum.TooltipDataType.Item' with an appropriate type for the tooltip
-- data you are wanting to process; eg. use 'Enum.TooltipDataType.Spell' for
-- replacing usage of OnTooltipSetSpell.
--
-- If you wish to respond to all tooltip data updates, you can instead replace
-- the enum with 'TooltipDataProcessor.AllTypes' (or the string "ALL").

TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, OnTooltipSetItem)
1 Like

So, per my error, I should change this:

function TipCounts:Hook(tip)
tip:HookScript(‘OnTooltipCleared’, self.OnClear)
tip:HookScript(‘OnTooltipSetItem’, self.OnItem)"

to this:

“function TipCounts:Hook(tip)
tip:HookScript(‘OnTooltipCleared’, self.OnClear)
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, OnTooltipSetItem)”

That won’t work unless you also create a OnTooltipSetItem function. I think you should be able to keep using the function you were using before:

TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, self.OnItem)”

Hey Gello, I’m faced with a different setup for this:

        function BankItems_Hooktooltip(tooltip)
        	-- Use nonsecure hooks and upvalues for speed
        	local a = tooltip:GetScript("OnTooltipSetItem")
        	if a then
        		tooltip:SetScript("OnTooltipSetItem", function(self, ...)
        			BankItems_AddTooltipData(self)
        			return a(self, ...)
        		end)
        	else
        		tooltip:SetScript("OnTooltipSetItem", BankItems_AddTooltipData)
        	end

how would I fix that? It’s from bankitems if that helps. It’s failing on the GetScript() call before I can even worry about the hook

At the moment, I replaced that with:

   function BankItems_Hooktooltip(tooltip)
       TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, BankItems_AddTooltipData)

but I have other errors I am tracking, so I don’t know if that worked or not

EDIT: got rid of the other errors. But while this doesn’t throw a lua error, it also doesn’t add the item count on my toon to the tooltip nor does it add the count to the overall total, so my logic must be wrong somewhere. Maybe it is some sort of recursive setup?

OK, I added this:

function
	TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, OnTooltipSetItem)
	end
end

But now I’m getting this error " ‘)’ expected near ‘.’ "

I saw on another lua page “Lua parameter names can not contain a dot. Lua variable and function names are generally short and lower case, if you do want two words, an underscore may be used (ex: “event_area”)” and " Use event , not event.area as function argument. Alternatively, if you call your function with event.area as argument, change it to area and get rid of the first line inside your function."

No. You need to change your original code to this:

function TipCounts:Hook(tip)
tip:HookScript(‘OnTooltipCleared’, self.OnClear)
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, self.OnItem)
1 Like

At a glance, I don’t see anything wrong with TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, BankItems_AddTooltipData). BankItems is not doing anything with the parameters (which is a table that contains–among other things–the itemID as ‘id’), but instead parses the itemID from the second return of self:GetItem() which still works.

In your shoes I would experiment by hard-coding things to add and see if they add, put prints() in the code to see what stuff is running.

Bug fixed. Thanks!

Ok, I’ll see what I can figure out. I thought maybe it was a recursion thing cause the “if a” portion also returned a call to a() while the else did not. Looked like a recursive thing.

Maybe a side question: Is there anything analogous to

local a = tooltip:GetScript("OnTooltipSetItem")

That I can do incase I do need that if?

That local a = etc business is just to make an unsecure pre hook. All of it should be commented out or deleted entirely. The thing it’s trying to hook no longer exists.

It’s not recursive. It’s defining an old version of the function (any preexisting OnTooltipSetItem), doing its own thing and then calling the old version after it’s done.

This

        	local a = tooltip:GetScript("OnTooltipSetItem")
        	if a then
        		tooltip:SetScript("OnTooltipSetItem", function(self, ...)
        			BankItems_AddTooltipData(self)
        			return a(self, ...)
        		end)
        	else
        		tooltip:SetScript("OnTooltipSetItem", BankItems_AddTooltipData)
        	end

In its entirety should be replaced with this:

TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, BankItems_AddTooltipData)

edit: It has occured to me that it’s a pre hook so maybe it’s depending on the tooltip:Show() to be done downstream. I’m not sure.
edit2: Then again, it’s doing a direct set so it has to take on the show responsibility too. I don’t know, sorry.

1 Like

There is a manual call to tooltip:Show() it looks like.

It’s ok. Thanks for what you were able to provide. I’m probably just hanging onto this addon for too long.

Uggh…now this: Message:…s/Bagnon/common/Wildpants/features/tooltipCounts.lua:36: hooksecurefunc(): SetQuestItem is not a function

Looks like some kind of new frame call: GameTooltip:SetQuestItem(type, index)

“GameTooltip (inherits from Frame) formats a tooltip. There is one named _G[“GameTooltip”], but others are created with CreateFrame(“GameTooltip”) or >”

Any ideas?

Bagnon & BagBrother need dozens of lines replaced to make them work with the current patch. You’re better off just waiting for jailbroc to update it.

2 Likes

For posterity, I found the fix for this…most of the hook functions have ‘tip’ which needs to be changed to ‘GameTooltip’

hooksecurefunc(tip, ‘SetQuestItem’, self.OnQuest)

hooksecurefunc(GameTooltip, ‘SetQuestItem’, self.OnQuest)

that probably means that tip was pointing to something else, its not a blizzard variable/global.

ie you would be better off finding where that variable was set and resetting it - or checking why it would be set to something else.

GameTooltip is not the only tooltip, there are several and its possible it was looping through them to make it a generic function.

1 Like