Thread Tools Display Modes
04-29-06, 03:18 PM   #1
Vardelm
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 15
printing debuff tooltip text???

I'm working on a function that will find the tooltip text for debuffs and print it out somehow, whether to chat or to a window somehow. This is really just a development tool. I'm planning to write some functions which also scan tooltips, but I'm not exactly sure what text to scan for. This tool is to show what text is there so I can figure out what to scan for.

I'm having quite a bit of trouble so far. Here's what I have so far:

XML:
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
	<Script file="ToolTipScan.lua"/>
	<GameTooltip name="TipReaderTooltip" frameStrata="TOOLTIP" hidden="true" inherits="GameTooltipTemplate">
		<Scripts>
			<OnLoad>
				this:SetOwner(UIParent, "ANCHOR_NONE")
			</OnLoad>
		</Scripts>
	</GameTooltip> 
</Ui>
LUA:
Code:
function TipReader(unit)
	TipReaderTooltip:SetOwner(UIParent, "ANCHOR_NONE");
	local i = 1;
	while UnitDebuff(unit, i) do 
		TipReaderTooltip:ClearLines();
		TipReaderTooltip:SetUnitDebuff(unit,i);
		local myDebuffText = TipReaderTooltipTextLeft1:GetText();
		SmartChat(myDebuffText);
		i = i + 1;
	end;
end
FYI, the SmartChat function I'm calling in the LUA file is a function from Discord Macro Functions. It just sends a chat message with the given text. I'm starting out simple by tryig to just print out 1 single line of tooltip text. If I can understand how to get that to work, I can move on to getting all of the tooltip text.

Any suggestions?
  Reply With Quote
04-30-06, 05:23 PM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Does it give any error? Does it simply never find a debuff? Nothing jumps out that would prevent tooltips from being picked up.
  Reply With Quote
04-30-06, 06:55 PM   #3
Vardelm
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 15
Thanks for the reply.

At the moment, it seems like I'm not even getting off the ground with it. It gives the following error:
[string "TipReader("target")"]:1:attempt to call a global 'TipReader' (a nil value)
  Reply With Quote
04-30-06, 07:17 PM   #4
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Yeah looks like it's not loading at all.

In your shoes I would do this:

/script DEFAULT_CHAT_FRAME:AddMessage(tostring(TipReaderTooltip))

and if it says nil, then the xml isn't loading at all. I'd check the .toc to make sure you named it ok and there are no spaces at the end of the filename(s). Then I'd check the FrameXML log in the Logs folder or load it up in Firefox to look for errors. That's if you don't use an XML-validation program (which you may given all the extra stuff in the <Ui> tag.)

It also helps to simplify the XML to find out where it's croaking:

Code:
<Ui>
	<Script file="ToolTipScan.lua"/>
	<GameTooltip name="TipReaderTooltip" inherits="GameTooltipTemplate"/>
</Ui>
See if DEFAULT_CHAT_FRAME:AddMessage(tostring(TipReaderTooltip)) returns a table or nil. If a table, then the mod loads and the element is seen. Can add stuff now:

Code:
<Ui>
	<Script file="ToolTipScan.lua"/>
	<GameTooltip name="TipReaderTooltip" inherits="GameTooltipTemplate">
		<Scripts>
			<OnLoad>
				this:SetOwner(WorldFrame, "ANCHOR_NONE")
			</OnLoad>
		</Scripts>
	</GameTooltip> 
</Ui>
  Reply With Quote
05-01-06, 06:40 PM   #5
Vardelm
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 15
OK, I'm a n00b.

Turns out it was pretty simple. The line in the xml file that reads:
Code:
<Script file="ToolTipScan.lua"/>
should have been:
Code:
<Script file="TipReader.lua"/>
"ToolTipScan" was what I was calling the addon right at first. I changed to TipReader so that it didn't sound so similar to some of the commands I was using in the lua file.

Your tip about reading the log file is what helped me discover it. So thanks much for the help!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » printing debuff tooltip text???


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off