Hyperlink Tooltip Help
This code has been around for a while and (first found it with NeavUI) but it seems to wrk for most item links except battle pets is there something im missing? Does a battle pet link have it own link style?
In this first image you will notice the mouseover is working. ( I also have fstack enabled to see what the difference in links are) In this second image I linked a battle pet in the "say" channel and no tooltip. (again fstack is enabled) Here is the current code I am using: Code:
local _G = getfenv(0) Thanks Coke |
Battle pets have their own tooltip object; they don't use the GameTooltip at all. Battle pet abilities, garrison followers, follower abilities, and missions also have their own tooltips objects. You can see how the default UI handles those here, though really it would be a lot easier to just call the click function on mouseover instead of recreating it:
Code:
chat:HookScript('OnHyperlinkEnter', ChatFrame_OnHyperlinkShow) Code:
local linktypes = { Also you can just use HookScript instead of manually storing and replacing and calling the original script. If there is no original script then HookScript behaves exactly like SetScript. |
Quote:
Quote:
Quote:
So this is what I tried and didn't get to work: Code:
local _G = getfenv(0) Coke |
so I figured it out (kinda on my own :P)
in Phanx's original code the linkType the T was no capitalized in the function code so it was not finding the table. Code:
local linktypes = { Coke |
That works too, but your last attempt didn't work because you were using some awful table-creating Frankenstein instead of the code I posted.
(1) When you use HookScript you should not manually capture and call the original script -- if you do that, it will be called twice, once before your script, and once from inside your script. If the original method toggles something, then calling it twice is like not calling it at all. (2) You were looping over a list of string values and trying to call frame methods on them. This would generate a Lua error telling you exactly what and where the problem was. I know I've told you before -- go get an error display addon and use it! (3) Even if you fixed #2, you'd still be attempting to show every tooltip object at the same time, which doesn't even make sense, because... (4) You'd also be calling methods like SetOwner and SetHyperlink on objects that do not have those methods. Battle pet and garrison related tooltips are not GameTooltip-type objects, and cannot display arbitrary hyperlinks. |
is there a SetPoint I can use to have the tooltip for the hyperlink show above my chatframe instead of above my mainmenubar?
I guess what im asking is were would I put this code: Code:
local i Coke |
Quote:
And believe it or not Phanx I listen to everything you have to say on coding, It might not sink in for the first few attempts or tries but in the end all my code seems to have the Phanx Seal of Approval :p because it is how you have written it. Coke |
Just found out you need to add:
Code:
currency = true, Coke |
Quote:
Code:
tooltip:SetOwner(parentFrame, "ANCHOR_NONE") Also, you shouldn't use Bugger and BugSack at the same time -- they both do the same thing. Pick the one you prefer, and get rid of the othe one. :p |
Hey Phanx, coud you please post a final coude of this that works?
I'd realy like to see Battele Pet Tooltips on hoover and all tooltips shoud be anchored on top of my chatframe. Also any way to make it work with TipTac? I have tryed to get something to work with the things posted here but no chance :( I'm currently using this: Lua Code:
|
Quote:
Quote:
|
Quote:
...and its also not OP's code and I knew you woud read it :P |
Quote:
Code:
local showLinkType = { |
Thank you, but it gives this error and nothing is happening :S but the code is still awesome!
Code:
2x LinkHover\LinkHover-1.3.lua:52: 'for' limit must be a number Lua Code:
|
try NUM_CHAT_WINDOWS
|
Quote:
Code:
9x LinkHover\LinkHover-1.4.lua:22: attempt to index global 'linkData' (a nil value) |
like Phanx said further up, you need to use SetOwner
Lua Code:
you can find a list of anchors here: http://wowprogramming.com/docs/widge...oltip/SetOwner edit: you edited your post :P |
Ok it works now for normal tooltips but gives error with Gnosis when trying too mouseover PetLinks,
When I disable Gnosis it gives error with BadBoy etc ... So disabeling all AddOns give this error: Code:
4x FrameXML\ItemRef.lua:252: ItemRefTooltip:SetHyperlink(): Unknown link type Lua Code:
|
I think the SetItemRef call in OnHyperlinkEnter should be this instead:
Code:
SetItemRef(linkData, link, "LeftButton", frame) Code:
ItemRefTooltip:Hide() |
Quote:
Quote:
|
Quote:
The default UI calls SetItemRef each time you click on a link, and for tooltips it acts as a toggle -- the first click shows the tooltip, and the second click hides it. |
So its not possible to anchor the Pet tooltip at the same point as the normal tooltip when you hoover it?
|
I tried to make it behave as consistently as I could between the real tooltip and the pseudo-tooltips:
Code:
local tooltipForLinkType = { |
@Vrul also nice, but I woud still prefere to have the tooltips above chat so I can mouseover links without hiding any text in my chatwindow :)
|
So 7.1 broke this code!
Addon still works partly but I get a spamy error, please someone help? :(
Error Code: Code:
439x LinkHover\LinkHover-1.5.lua:34: attempt to index local 'linkData' (a nil value) Lua Code:
|
Try changing this:
Code:
local function OnHyperlinkEnter(frame, linkData, link) Code:
local function OnHyperlinkEnter(frame, link, text) Code:
local function OnHyperlinkLeave(frame, linkData, link) Code:
local function OnHyperlinkLeave(frame, link, text) Code:
SetItemRef(linkData, link, "LeftButton", frame) Code:
SetItemRef(link, text, "LeftButton", frame) |
Thanks for the reply Phanx! I think I made exactly the changes you posted but I still get exactly the same error, so I guess its something different going on here. I also disable all other addons.
Code:
13x LinkHover\LinkHover-1.6.lua:34: attempt to index local 'link' (a nil value) Lua Code:
|
1 Attachment(s)
For easy testing here is a download link:
|
Replace:
Code:
local function OnHyperlinkLeave(frame, link, text) Code:
local function OnHyperlinkLeave(...) |
Quote:
Lua Code:
and got this chat printout: Code:
OnHyperlinkLeave table: 00000165D37D7F7 Code:
OnHyperlinkLeave table: 00000165D35AEEA0 |
1 Attachment(s)
Thank you for the help again Phanx, Humfras had some time today and did the rest of the fix. Thank you again.
Here is a new working version: |
That means it's only receiving the "self" argument, without any information about the link. You'll have to keep track of that yourself:
Code:
local lastLink, lastText, useGameTooltip |
All times are GMT -6. The time now is 03:33 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI