Thread Tools Display Modes
08-14-09, 01:44 PM   #1
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Changing a tag on mouseover.

So I'm looking for a way to do this but they all seem kind of hack-y. I originally tried adding it to my frames OnEnter script but oUF seems to ignore changing a tag.

I tried moving it to the health tag and adding UPDATE_MOUSEOVER_UNIT to the tag events, but... It doesn't actually fire for the tag. It fires fine if I register the event on a frame of my own, but not for my tag.

Code:
oUF.TagEvents['[magsshealthperc]'] = 'UPDATE_MOUSEOVER_UNIT UNIT_HEALTH UNIT_MAXHEALTH'
oUF.Tags['[magsshealthperc]'] = function(unit)
	local cur, max = UnitHealth(unit), UnitHealthMax(unit)
	local r, g, b = oUF.ColorGradient(cur / max, unpack(oUF.colors.smooth))
	
	if _G[GetMouseFocus():GetName()].unit == 'target' then
		return oUF.Tags['[curhp]'](unit)
	else
		return format('|cff%02x%02x%02x%s%%|r', r * 255, g * 255, b * 255, floor(cur / max * 100))
	end
end
I can get the code to work if I set my tag to frequently update but that's a lot of unnecessary processing I'd rather avoid. Are there any more elegant alternatives to this?
  Reply With Quote
08-19-09, 03:47 PM   #2
Sojik
A Wyrmkin Dreamwalker
 
Sojik's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 53
oUF_Caellian has a PvP tag that shows on mouseover on the player and target frame. What if you used that code and had two tags. One that hid on mouseover and another that showed?
  Reply With Quote
08-19-09, 03:52 PM   #3
Sojik
A Wyrmkin Dreamwalker
 
Sojik's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 53
Code:
self:SetScript("OnEnter", function(self) self.Status1:SetAlpha(1); self.Status2:SetAlpha(0); UnitFrame_OnEnter(self) end) 
self:SetScript("OnLeave", function(self) self.Status1:SetAlpha(0); self.Status2:SetAlpha(1); UnitFrame_OnLeave(self) end)
Something along these lines, maybe.
  Reply With Quote
08-19-09, 09:56 PM   #4
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Oh, two tags. That's clever and will work out great. Thanks!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Changing a tag on mouseover.


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