Saturday, April 21, 2012

Tooltips

Hi,

Could anyone give me a brief explanation of how they work? More specifically, what event tells the tooltip what to display? I can't find any explanation on wowwiki.

Cheers.|||Check out http://www.wowwiki.com/Widget_API#GameTooltip

Basically: You set the text of GameTooltip by GameTooltip:SetText("Title"), append with GameTooltip:AddLine("Some text"); and show it with GameTooltip:Show();|||Thanks Dinnerbone.

But what event triggers tooltips to show up in the game, say when you mouseover a mob or pet etc? And can that event be used in mods?

Cheers.|||In your xml, the OnEnter triggers it.


Code:
<Scripts> 
<OnEnter>
GameTooltip:SetText(text)
</OnEnter>
</Scripts>

http://www.wowwiki.com/API_GameTooltip_SetText

Or you have to hook some Blizzard function such as GameTooltip_ShowCompareItem(). I don't think there is any API event you can use.|||Ok thanks. So there's no way to detect specifically what mob or item in the world is under the mouse cursor? I found
Code:
GetMouseFocus()

but it just returns World frame no matter what the mouse is over.|||I don't know the answer. Maybe if you could describe what you are trying to do with your addon we can better understand what you need. Or maybe not. LOL|||I'm trying to make a basic hunter pet mod that displays extra pet info on the tooltip when you mouse over the pet. I have all the info sorted and can print it to chat or wherever, I just can't work out the tooltip bit. I can write to the tooltip, I just can't work out how to get it to show up specifically when the mouse is over the pet.|||If you look at the PetFrame in the FrameXML you will see


Code:
<OnEnter>
UnitFrame_OnEnter(self);
PartyMemberBuffTooltip:SetPoint("TOPLEFT", this, "TOPLEFT", 60, -35);
PartyMemberBuffTooltip_Update("pet");
</OnEnter>

You can look at the pet Lua and the pet xml here http://wdn.wowinterface.com/latest

You can see where or what function you might want to hook.|||Quote:








Check out http://www.wowwiki.com/Widget_API#GameTooltip

Basically: You set the text of GameTooltip by GameTooltip:SetText("Title"), append with GameTooltip:AddLine("Some text"); and show it with GameTooltip:Show();




Uhm, relatively random intermission here: would I be able to use some of this stuff to remove information from essentially all of my tooltips? Especially things like level and monster type? Maybe even names... though that'd leave awfully little tooltip, heh.

What kind of tooltip are we talking here? What kind of information is controlled by it? All "mouse-over" information? Just NPCs/PCs? What about items and such?|||Thanks guys,

I got it working using the event:


Code:
UPDATE_MOUSEOVER_UNIT

and
Code:
UnitName("mouseover") == UnitName("pet")

to see if my pet was under the cursor. Works nicely :)

No comments:

Post a Comment