View Single Post
01-30-09, 11:59 AM   #591
Bruners
A Flamescale Wyrmkin
 
Bruners's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 125
Originally Posted by Balkeep View Post
Is there any actual way to hide 0 numbers on text fields when im using tag system?

Im creating fonstring like this
Code:
	self.Health.mvalue = self.Health:CreateFontString(nil, "OVERLAY")
	self.Health.mvalue:SetFont(font, fontS)
	self:Tag(self.Health.mvalue, '-[missinghp]')
	self.Health.mvalue:SetPoint("TOPRIGHT", self.Health, "TOPRIGHT", -3, -3)
works just fine, but is there any way to hide value of the field self.Health.mvalue if its == 0 ?
yes but you would have to make a custom tag

Code:
oUF.Tags["[custom]"] = function(unit)
	local m, n = UnitHealthMax(unit), UnitHealth(unit)
	return n == 0 and "" or string.format("-%s", m - n)
end
oUF.TagEvents["[custom]"] = "UNIT_HEALTH UNIT_MAXHEALTH"

Last edited by Bruners : 01-30-09 at 12:38 PM. Reason: added the - to the tag