View Single Post
02-21-10, 12:44 PM   #9
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Originally Posted by wurmfood View Post
Try this:
Code:
local function UpdateComboPointsFormat(self, event, unit)
	if( self.CPoints ) then
		local ccp = GetComboPoints(unit)		
		if ccp == 5 then
			self.CPoints:SetTextColor(1, 0, 0)
		else
			self.CPoints:SetTextColor(0.90, 1, 1)
		end
	end
end
Awesome! It works without errors. It was working but it was giving me errors because it was indexing CPoints even if the conditions weren't met in the IF. Now it's working without errors! Thanks!

So the final code to "color" combo points is, if anyone interested:

Code:
local function UpdateComboPointsFormat(self, event, unit)
						
						
		if (self.CPoints) then
				local ccp = GetComboPoints(unit,'target')		
					if ccp == 1 then
						self.CPoints:SetTextColor(241/255, 241/255, 241/255)
					elseif ccp == 2 then
						self.CPoints:SetTextColor(241/255, 241/255, 241/255)
					elseif ccp == 3 then
						self.CPoints:SetTextColor(211/255, 241/255, 11/255)
					elseif ccp == 4 then
						self.CPoints:SetTextColor(241/255, 141/255, 11/255)
					elseif ccp == 5 then
						self.CPoints:SetTextColor(241/255, 11/255, 11/255)
					end
			
		end
end
And the Register Event

self:RegisterEvent("UNIT_COMBO_POINTS", UpdateComboPointsFormat)

Awesome! More Quick Feedback to the combo points.

Thanks a lot to all that helped me.
  Reply With Quote