Thank you, you put me on the right track! I used the tag inside the "target" definition, that can't work
So, in addition to your improvements, I changed it from
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
to
Code:
if (unit == 'player') then
local comp = self:CreateFontString(nil, 'OVERLAY')
comp:SetFont(font, fsize, 'OUTLINE')
comp:SetPoint('LEFT', self, 'RIGHT', 10, 0)
self:Tag(comp, '[customcpoints]')
end
that. Now it works great!
But I have a another, very simillar problem. I've created a custom tag to display the creature type. Here's the code:
Code:
local creatures = {
Humanoid = 'Hu',
Dragonkin = 'Dragon',
Elemental = 'Ele',
Undead = 'Ud',
Critter = 'Crit',
Mechanical = 'Mech',
["Not specified"] = 'N/A',
["Non-combat Pet"] = 'Pet',
["Gas Cloud"] = 'Gas',
}
oUF.TagEvents['[customcreature]'] = 'UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION UNIT_CLASSIFICATION_CHANGED'
oUF.Tags['[customcreature]'] = function(unit)
local ct = UnitCreatureType(unit)
return (creatures[ct] or ct)
end
...
Code:
if (unit ~= 'targettarget') then
local ctype = self.Health:CreateFontString('nil', 'OVERLAY')
ctype:SetFont(font, fsize-2, 'OUTLINE')
ctype:SetPoint('RIGHT', self, 0, 30)
self:Tag(ctype, '[customcreature]')
end
It works well, but it doesn't update if the creature type changed. I'm making this layout mainly for my druid. If I switch into cat and reload UI, it say's "Beast". But when I switch from cat to caster (without reloading the UI), it still says "Beast" [Of cause if I'm in caster stance and reload UI it says "Hu", but it then doesn't change to "Beast" if I switch into cat]. Any idea why the tag isn't updated?
(This bug doesn't bother me too much, but since I make this layout to learn something about lua and oUF, I would be really happy to know what causes this behavior)