Thread Tools Display Modes
11-02-06, 06:16 PM   #1
Syzgyn
An Aku'mai Servant
 
Syzgyn's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 37
Problem Parsing Weapon Tooltips

I'm trying to pull the weapon DPS out of its tooltip to use for some calculations. Here's my psuedo-code

Code:
xDEP_Tooltip:ClearLines();
	xDEP_Tooltip:SetInventoryItem("player", 16)
	
	local textFrame = getglobal(xDEP_Tooltip:GetName() .. "TextLeft" .. 5);
         local text = textFrame:GetText();
	local mh = string.sub(text, 2,5);
	DEFAULT_CHAT_FRAME:AddMessage("MH: " .. mh);
	xDEP_Tooltip:Hide()
	
	xDEP_Tooltip:ClearLines();
	xDEP_Tooltip:SetInventoryItem("player", 17)
	
	local textFrame = getglobal(xDEP_Tooltip:GetName() .. "TextLeft" .. 5);
        text = textFrame:GetText();
	local oh = string.sub(text, 2,5);
	DEFAULT_CHAT_FRAME:AddMessage("OH: " .. oh);
	xDEP_Tooltip:Hide()
And the tooltip code
Code:
	<GameTooltip name="xDEP_Tooltip" inherits="GameTooltipTemplate">
		<Scripts>
			<Onload>
				this:SetOwner(this, "ANCHOR_NONE");
			</Onload>
		</Scripts>
	</GameTooltip>

The problem is it doesn't get anything past the first tooltip. So if I call it once It grabs the Main hand, but not the Off hand. Then if I all it again without reloading in between, it doesnt grab anything.

Any help would be much appreciated
  Reply With Quote
11-03-06, 04:48 PM   #2
Maul
Ion Engines, Engage!
 
Maul's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 401
I think the problem is you are trying to hide a tooltip that is never seen in the first place.

Try removing the lines -

xDEP_Tooltip:Hide()

and see if that helps.
  Reply With Quote
11-04-06, 02:11 AM   #3
Syzgyn
An Aku'mai Servant
 
Syzgyn's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 37
Excelent! Thanks muchly.

Another question: Is there some way to have a tooltip update while its up?
Code:
	<OnEnter>
		GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
		AS_OnMouseOver();
	</OnEnter>
Thats what I'm using to have it show up now. Is there some call to have it update every second or so?
  Reply With Quote
11-04-06, 02:27 AM   #4
wmrojer
A Deviate Faerie Dragon
 
wmrojer's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 13
Code:
<OnUpdate>
  if GameTooltip:HasOwner(this) then
    GameTooltip:Hide()
  end
  GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
  AS_OnMouseOver();
</OnUpdate>
This will have it update every frame. Put in limitation at your will.
  Reply With Quote
11-04-06, 03:23 PM   #5
Maul
Ion Engines, Engage!
 
Maul's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 401
Thumbs down

I have a custom tooltip addon that replaces the standard one, and I use something like this to keep it updated with current info:

Code:
<OnUpdate>
        if (UnitExists("mouseover")) then
		MyGameTooltipUpdate("mouseover");
	end
</OnUpdate>
And the function I call simply refreshes the info and apllies a Show() to the tooltip.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Problem Parsing Weapon Tooltips


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