I've got a question about SetFont(), I suppose. My text seems to be working for health, power, name, and info objects, but it refuses to work for cast bar and druid mana.
My mana bar code is:
Code:
if unit == "player" and playerClass == "DRUID" then
self.DruidPower = CreateFrame('StatusBar', nil, self)
self.DruidPower:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', -2, 0)
self.DruidPower:SetStatusBarTexture(texture)
self.DruidPower:SetHeight(playerHPHeight)
self.DruidPower:SetWidth(playerHPWidth)
self.DruidPower:SetFrameStrata("HIGH")
self.DruidPower:SetAlpha(0)
self.DruidPower.value = self.DruidPower:CreateFontString(nil, "OVERLAY")
self.DruidPower.value:SetFont(font, 10, "NONE")
self.DruidPower.value:SetShadowOffset(1, -1)
self.DruidPower.value:SetPoint('CENTER', 0, 3)
self.DruidPower.value:SetTextColor(1, 1, 1)
self.DruidPower.bg = self.DruidPower:CreateTexture(nil, 'BORDER')
self.DruidPower.bg:SetAllPoints(self.DruidPower)
self.DruidPower.bg:SetTexture(0, 0, 0, 0.6)
self:RegisterEvent('UNIT_MANA', UpdateDruidPower)
self:RegisterEvent('UNIT_ENERGY', UpdateDruidPower)
self:RegisterEvent('PLAYER_LOGIN', UpdateDruidPower)
end
...which creates the frame well enough.
This is my update function:
Code:
local function UpdateDruidPower(self)
local bar = self.DruidPower
local num, str = UnitPowerType('player')
local min = UnitPower('player', (num ~= 0) and 0 or 3)
local max = UnitPowerMax('player', (num ~= 0) and 0 or 3)
bar:SetMinMaxValues(0, max)
if(min ~= max) then
bar:SetValue(min)
bar:SetAlpha(1)
bar:SetStatusBarColor(unpack(oUF.colors.power['MANA']))
bar.value:SetFormattedText('%d / %d', min, max)
else
bar:SetAlpha(0)
bar.value:SetText()
end
end
This is throwing errors whenever I shift in and out:
oUF_Saone-1.0\ouf_saone.lua:154: <unnamed>:SetText(): Font not set
oUF_Saone-1.0\ouf_saone.lua:154: in function `?'
oUF-1.3.5\ouf.lua:112: in function <Interface\AddOns\oUF\ouf.lua:110>
...and another for the other SetFormattedText() earlier (line 154 is bar.value:SetText())
Any ideas? It's obviously something to do with my font, but I declared that correctly. This is driving me nuts, and I don't *THINK* I'm doing anything horribly wrong.
Also, any ideas on how to make it despawn faster? It seems to linger for a few seconds after I shift out.
Edit:
If I change my
self.DruidPower.value = self.DruidPower:CreateFontString(nil, "OVERLAY")
to:
self.DruidPower.value = self.DruidPower:CreateFontString(nil, "OVERLAY", "GameFontHighlightExtraSmall")
...it works, but that's not entirely what I'm trying to achieve.
Edit again:
Looks like self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", UpdateDruidPower); helps the frame despawn faster. I'm not familiar with other oUF modules using that, so I figured I'd mention it.
/sigh...