Thread: Tags and Events
View Single Post
05-08-09, 01:13 AM   #1
kip
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 7
Tags and Events

hey,

I'm trying to make my first oUF Layout. I'm using P3Lim's Layout as basis, but I'm having some problems to understand the tag system.

Following P3lim's example, I created a custom tag to show the combo-points.
The code looks like this:

Code:
oUF.TagEvents['[customcpoints]'] = 'UNIT_TARGET UNIT_COMBO_POINTS'
oUF.Tags['[customcpoints]'] = function(unit)
   -- if (unit ~= 'player') then return end
   local cp = GetComboPoints('player', 'target')
   local sw = {
      [1] = '|cFFFFFFFF%s',
      [2] = '|cFFFFFFFF%s',
      [3] = '|cFFebee14%s',
      [4] = '|cFFf4aa0b%s',
      [5] = '|cFFf40b0b%s',
   }
   if (cp > 0) then return format(sw[cp], cp)
   else return end  
end
...

Code:
   if (unit == 'target') then
   
		local comp = self:CreateFontString(nil, 'OVERLAY')
		comp:SetFont(font, fsize, 'OUTLINE')
		comp:SetPoint('LEFT', self, 'RIGHT', 10, 0)
		self:Tag(comp, '[customcpoints]')
   
   end
But this doesn't really work. If I just attack my target it shows nothing. If I clear my target during combat and retarget the mob it shows "something" (most of the time a false value ... e.g. if I should have 1 CP it display 2 or 3 or something like that).
Can somebody tell me what I'm doing wrong?

thanks!

P.S.: I saw that p3lim uses another way to display the combopoints, but this is kind of an experiment to understand and get used to the tag-system.
  Reply With Quote