local function RemoveMadeByLines( tooltip )
local tooltipName = tooltip:GetName()
for i = 2, tooltip:NumLines() do
local line = _G[ tooltipName .. "TextLeft" .. i ]
local text = line:GetText()
if text and text:match( "^<Made by %S+>$" ) then
line:SetText( "" )
tooltip:Show()
break
end
end
end
for _, tooltip in pairs( {
"GameTooltip",
"ItemRefTooltip",
"ShoppingTooltip1",
"ShoppingTooltip2",
} ) do
if _G[ tooltip ] then
_G[ tooltip ]:HookScript( "OnTooltipSetItem", RemoveMadeByLines )
end
end
The function looks at the text on each line in the tooltip, starting at line 2. If it finds a line that matches the Made by pattern, it sets that lines text to nothing, calls the tooltips Show method to refresh the tooltip, and then stops looking.
The for loop goes through a list of common tooltips, checks if they exist, and hooks their OnTooltipSetItem script with the function. Then, every time a tooltip is told to show an item, it runs your function. Using HookScript instead of SetScript makes sure that you dont overwrite functions from other addons that want to do the same thing.
Thanks for the explanation, but the code doesn't appear to work. I tried the addon you posted before to make sure it wasn't a problem my end and it appeared to work, so I'm not sure what's wrong with the code, there are no LUA errors or anything.
Does anyone have any sample code I could use?
Thanks
I do this in my addon Item Tooltip Cleaner. The code is pretty simple, if you want to take a look.
It's still pretty complex to me.
The function looks at the text on each line in the tooltip, starting at line 2. If it finds a line that matches the Made by pattern, it sets that lines text to nothing, calls the tooltips Show method to refresh the tooltip, and then stops looking.
The for loop goes through a list of common tooltips, checks if they exist, and hooks their OnTooltipSetItem script with the function. Then, every time a tooltip is told to show an item, it runs your function. Using HookScript instead of SetScript makes sure that you dont overwrite functions from other addons that want to do the same thing.
Works fine, not sure why the other method wouldn't work with an enGB client though.
Who knows why anything does anything. lol