WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Classic - AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=179)
-   -   Player corpse tooltip (https://www.wowinterface.com/forums/showthread.php?t=59828)

atshn 03-18-24 12:42 PM

Player corpse tooltip
 
Might be an odd request but is it possible to hide the tooltip that shows when mousing over a player's corpse (on Hardcore if that matters). This is what I'm using to hide the tooltip when mousing over a player, but it doesn't work on player corpses.

Code:

GameTooltip:SetScript("OnTooltipSetUnit",function(self)GameTooltip:Hide()end)

SDPhantom 03-18-24 05:13 PM

I haven't tested this past running it through a Lua compiler.
Code:

GameTooltip:HookScript("OnShow",function(s)if _G[s:GetName().."TextLeft1"]:GetText():find"^Corpse of "then s:Hide()end end)

I revised the provided code as well. :SetScript() will break things if there's already an existing script. It's advised to use :HookScript() instead. The caveat being you don't want to run this line multiple times or you end up stacking identical callbacks on top of each other. There's also an existing function (GameTooltip_Hide()) for hiding the tooltip made for calls from XML templates.
Code:

GameTooltip:HookScript("OnTooltipSetUnit",GameTooltip_Hide)
I'm assuming this is to be put into a macro hence the removal of optional whitespace.

atshn 03-18-24 05:24 PM

That worked perfect. Much appreciated! Thanks for cleaning up the other code as well.

atshn 03-18-24 05:26 PM

Quote:

Originally Posted by SDPhantom (Post 343571)
I'm assuming this is to be put into a macro hence the removal of optional whitespace.

I missed this. I have this in an addon. Any problems with the removal of whitespace? Still learning.

SDPhantom 03-18-24 07:45 PM

It's purely cosmetic and hinders readability. Extreme cases like shortening variable names to a single letter may run afoul of Blizzard's addon policy due to their obfuscation rule. You can only really get away with it when writing for macros where the size constraint is an issue. There are other size optimizations I used in the code I posted like parenthesis are optional when the only argument to calling a function is a literal string or table constructor. For the most part, it's best to stick to a more normalized style when writing addons.

atshn 03-19-24 06:33 PM

Noted. :) I constantly see your name when googling for answers. You've answered my questions more than you know. Maybe you can answer one that has been bugging me for a while now if you don't mind. Is it possible in some way to hide the floating name of players when I target them? I'm using the default UI. I have "friendly players" option unchecked (Classic) and that does what it's supposed to until you actually target a player, and then their floating name appears.

SDPhantom 03-20-24 10:27 PM

If there isn't a setting for it, then no. The plain text names (as opposed to NamePlates) are rendered by C-code and are inaccessible by the UI.

NamePlates do replace the plain text names when enabled, but hiding those are impossible on certain unit types due to spawning forbidden frames, which can't be touched by addons.

atshn 03-21-24 11:13 AM

Good to know. Thanks again


All times are GMT -6. The time now is 12:35 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI