Thanks =)
Now it displays right but the power is still there. I have deleted all "single" power functions but it's still there and with the two nil and hide comments you posted in your first post i get this error:
Code:
Message: Interface\AddOns\oUF_Hank_v3\hank_v3.lua:175: attempt to index field 'power' (a nil value)
Time: 12/06/11 03:18:46
Count: 1
Stack: Interface\AddOns\oUF_Hank_v3\hank_v3.lua:175: in function <Interface\AddOns\oUF_Hank_v3\hank_v3.lua:123>
[C]: in function `func'
Interface\AddOns\oUF\ouf.lua:153: in function <Interface\AddOns\oUF\ouf.lua:144>
(tail call): ?
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:83: in function <Interface\FrameXML\SecureStateDriver.lua:73>
Interface\FrameXML\SecureStateDriver.lua:137: in function <Interface\FrameXML\SecureStateDriver.lua:119>
Locals: self = oUF_focus {
0 = <userdata>
Debuffs = focus_Debuffs {
}
__tags = <table> {
}
UNIT_ENTERED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:164
unit = "focus"
SpellRange = <table> {
}
PLAYER_FOCUS_CHANGED = <function> defined @Interface\AddOns\oUF\ouf.lua:144
UNIT_PET = <function> defined @Interface\AddOns\oUF\ouf.lua:164
healthFill = <table> {
}
UNIT_MAXHEALTH = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:512
__elements = <table> {
}
RAID_TARGET_UPDATE = <function> defined @Interface\AddOns\oUF\elements\ricons.lua:19
UNIT_AURA = <function> defined @Interface\AddOns\oUF\elements\aura.lua:209
HighlightAura = <unnamed> {
}
PLAYER_ENTERING_WORLD = <function> defined @Interface\AddOns\oUF\ouf.lua:144
PLAYER_FLAGS_CHANGED = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:654
RaidIcon = <unnamed> {
}
name = <unnamed> {
}
UNIT_HEALTH = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:504
style = "Hankv3"
menu = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:43
health = <table> {
}
Buffs = focus_Buffs {
}
UNIT_EXITED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:164
colors = <table> {
}
}
h = 122475
hMax = 122475
status = nil
hPerc = "100%"
len = 4
(*temporary) = nil
(*temporary) = nil
(*temporary) = 1
(*temporary) = 4
(*temporary) = "%"
(*temporary) = <function> defined =[C]:-1
(*temporary) = <unnamed> {
0 = <userdata>
}
(*temporary) = <userdata>
(*temporary) = 0.634765625
(*temporary) = 0.34375
(*temporary) = 0.671875
(*temporary) = <userdata>
(*temporary) = "attempt to index field 'power' (a nil value)"
oUF_Hank = <table> {
customFilter = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:283
PostUpdateName = <function> defined =[C]:-1
PreSetPosition = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:373
UpdateDispel = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:107
PostChannelStart = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:420
sharedStyle = <function> defined =[C]:-1
PostUpdateIcon = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:249
UpdateHealth = <function> defined =[C]:-1
PostSpawnFrames = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:479
PostCreateIcon = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:349
digitTexCoords = <table> {
}
PostCastStop = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:459
HideParty = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:59
AdjustMirrorBars = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:74
PostCastSucceeded = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:450
menu = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:43
PostCastStart = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:388
UpdateStatus = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:204
PostChannelStop = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:467
OnLeaveAura = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:344
OnEnterAura = <function> defined @Interface\AddOns\oUF_Hank_v3\hank_v3.lua:326
}
Thank you so much for your help! =) Seems to muss something little.
Whole Code:
Code:
local oUF_Hank = {}
oUF_Hank.digitTexCoords = {
["1"] = {1, 20},
["2"] = {21, 31},
["3"] = {53, 30},
["4"] = {84, 33},
["5"] = {118, 30},
["6"] = {149, 31},
["7"] = {181, 30},
["8"] = {212, 31},
["9"] = {244, 31},
["0"] = {276, 31},
["%"] = {308, 17},
["X"] = {326, 31}, -- Dead
["G"] = {358, 36}, -- Ghost
["Off"] = {395, 23}, -- Offline
["B"] = {419, 42}, -- Boss
["height"] = 42,
["texWidth"] = 512,
["texHeight"] = 128
}
oUF_Hank_hooks.ChangeFocus = {
sharedStyle = function(self, unit, isSingle)
if (unit == "focustarget") then
self.name:ClearAllPoints()
self.name:SetPoint("RIGHT")
end
if (unit == "focus") then
for i=1,4 do
self.health[i]:ClearAllPoints()
end
self.power:Hide()
self.power=nil
self.health[4]:SetPoint("RIGHT")
self.health[3]:SetPoint("RIGHT", self.health[4], "LEFT")
self.health[2]:SetPoint("RIGHT", self.health[3], "LEFT")
self.health[1]:SetPoint("RIGHT", self.health[2], "LEFT")
self.name:ClearAllPoints()
self.RaidIcon:ClearAllPoints()
self.RaidIcon:SetPoint("RIGHT",self.name,"LEFT",-10,0)
self.RaidIcon:SetPoint("TOP", self, "TOP", 0, -5)
self.Buffs.initialAnchor = "RIGHT"
self.Buffs["growth-x"] = "LEFT"
self.Debuffs.initialAnchor = "RIGHT"
self.Debuffs["growth-x"] = "LEFT"
end
end,
PostUpdateName = function(self)
if self.unit ~= "focus" then return end
if (self.name) then
self.RaidIcon:ClearAllPoints()
self.RaidIcon:SetPoint("TOP", self, "TOP", 0, -5)
-- Reanchor raid icon to the largest string (either name or power)
if self.name:GetWidth() >= self.power:GetWidth() then
self.RaidIcon:SetPoint("RIGHT", self.name, "LEFT", -10, 0)
else
self.RaidIcon:SetPoint("RIGHT", self.power, "LEFT", -10, 0)
end
end
end,
UpdateHealth = function(self)
if self.unit ~= "focus" then return end
local h, hMax
-- In vehicle
h, hMax = UnitHealth(self.unit), UnitHealthMax(self.unit)
local status = (not UnitIsConnected(self.unit) or nil) and "Off" or UnitIsGhost(self.unit) and "G" or UnitIsDead(self.unit) and "X"
if not status then
local hPerc = ("%d%%"):format(h / hMax * 100 + 0.5)
local len = string.len(hPerc)
for i = 1, 4 do
if i > len then
self.health[5 - i]:Hide()
self.healthFill[5 - i]:Hide()
else
local digit = string.sub(hPerc , -i, -i)
self.health[5 - i]:SetSize(oUF_Hank.digitTexCoords[digit][2], oUF_Hank.digitTexCoords["height"])
self.health[5 - i]:SetTexCoord(oUF_Hank.digitTexCoords[digit][1] / oUF_Hank.digitTexCoords["texWidth"], (oUF_Hank.digitTexCoords[digit][1] + oUF_Hank.digitTexCoords[digit][2]) / oUF_Hank.digitTexCoords["texWidth"], 1 / oUF_Hank.digitTexCoords["texHeight"], (1 + oUF_Hank.digitTexCoords["height"]) / oUF_Hank.digitTexCoords["texHeight"])
self.health[5 - i]:Show()
self.healthFill[5 - i]:SetSize(oUF_Hank.digitTexCoords[digit][2], oUF_Hank.digitTexCoords["height"] * h / hMax)
self.healthFill[5 - i]:SetTexCoord(oUF_Hank.digitTexCoords[digit][1] / oUF_Hank.digitTexCoords["texWidth"], (oUF_Hank.digitTexCoords[digit][1] + oUF_Hank.digitTexCoords[digit][2]) / oUF_Hank.digitTexCoords["texWidth"], (2 + 2 * oUF_Hank.digitTexCoords["height"] - oUF_Hank.digitTexCoords["height"] * h / hMax) / oUF_Hank.digitTexCoords["texHeight"], (2 + 2 * oUF_Hank.digitTexCoords["height"]) / oUF_Hank.digitTexCoords["texHeight"])
self.healthFill[5 - i]:Show()
end
end
end
end,
}