View Single Post
01-28-22, 05:23 PM   #1
ranjeet
A Defias Bandit
Join Date: Jan 2022
Posts: 2
Getting Tooltip Text

I found a macro that will enumerate through whatever tooltip is showing but cannot get it to work when trying to run it straight from a LUA file.

The macro is:
/run for i=1,GameTooltip:NumLines()do local mytext=_G["GameTooltipTextLeft"..i] local text=mytext:GetText()print(text)end

It works perfectly when hovering over something in-game and running the macro via key binding. But in order to get it to work in the main LUA file for this addon, it needs to run when a tooltip is actually there and ready to read. I am able to execute it via:

GameTooltip:HookScript("OnTooltipSetDefaultAnchor", somefunction)

This was the only GameTooltip handler that would fire for tooltips that are not associated with an item or unit. I need it to fire when highlighting over a chest, which cannot be done with any of the other GameTooltip handlers.

Does anyone have any idea on how I can get this macro code to work? I tried putting it in somefunction without the '/run' but nothing happens. I would greatly appreciate the help.
  Reply With Quote