Thread Tools Display Modes
12-04-11, 05:46 AM   #1
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Personal adjustment for ouf_hank?

Hey there,

as i am not really good in lua (sume tiny tweaks i am able to do but that's about it) i'm asking you here right now:

I want to change the focus frame from this to that:

Having right now:
http://www.abload.de/img/normalnqe8l.jpg

Wanted:
http://www.abload.de/img/editd07lb.jpg

I was searching in the hank.lua but it seems difficult to see which code to change to what cause focus seems to be handeled euqally to player frame etc.

So in textform: No absolute health/power and percentage right and name bigger.

Could anyone be able to help me please? (: That would be so great! If you are either on gorgonnash eu [H] or eredar [H] i could pay you with gold, if not i relay on your greatfullness (:

Hopefully someone could help me with that, thank you so much for your time, even reading this!

Greetings.
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-05-11, 04:28 AM   #2
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Check this mod I made, it "mirrors" the focus frame so one could put it on the left hand side of the screen. Just add

Code:
self.power:Hide()
self.power=nil
to the sharedStyle function inside the focus block, then HP/Power text should be hidden. Edit the self.name:SetPoint to position the name, adjust the size via SetFont.

Code:
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.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.power:ClearAllPoints()
		self.name:ClearAllPoints()
		self.RaidIcon:ClearAllPoints()
		
		self.name:SetPoint("BOTTOMRIGHT",  self.power, "TOPRIGHT")
		self.power:SetPoint("BOTTOMRIGHT", self.health[1], "BOTTOMLEFT")
		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
			
			
		
		self.power:ClearAllPoints()
		self.power:SetPoint("BOTTOMRIGHT", self.health[5-len], "BOTTOMLEFT", 0, 0)
	
	else
		
		self.power:ClearAllPoints()
		self.power:SetPoint("BOTTOMRIGHT", self.health[4], "BOTTOMLEFT", 0, 0)
		
	end
end,
}
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-05-11, 07:45 AM   #3
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Nvm i was totaly stupid I got it in but it's showing "weird and producing an error screen in a sec!

http://www.abload.de/img/wowscrnshot_120511_15k02d9.jpg

It really "mirrors" the frame but that makes it sort of unreadable :/ + that error

Code:
Message: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: attempt to index global 'oUF_Hank' (a nil value)
Time: 12/05/11 15:08:33
Count: 1
Stack: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: in function <...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:113>
[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
 power = <unnamed> {
 }
 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 = 97218
hMax = 97218
status = nil
hPerc = "100%"
len = 4
(for index) = 1
(for limit) = 4
(for step) = 1
i = 1
digit = "%"
(*temporary) = <function> defined =[C]:-1
(*temporary) = <unnamed> {
 0 = <userdata>
}
(*temporary) = nil
(*temporary) = "%"
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'oUF_Hank' (a nil value)"
Code:
Message: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: attempt to index global 'oUF_Hank' (a nil value)
Time: 12/05/11 15:09:54
Count: 1
Stack: ...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:136: in function <...nterface\AddOns\oUF_Hank_v3\custom_modifications.lua:113>
[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\UIParent.lua:1562: in function `SetUIPanel'
Interface\FrameXML\UIParent.lua:1632: in function `HideUIPanel'
Interface\FrameXML\UIParent.lua:1342: in function <Interface\FrameXML\UIParent.lua:1334>
[C]: in function `SetAttribute'
Interface\FrameXML\UIParent.lua:2060: in function `HideUIPanel'
Interface\FrameXML\UIParent.lua:2026: in function `ToggleFrame'
[string "TOGGLEWORLDMAP"]:1: in function <[string "TOGGLEWORLDMAP"]:1>
[C]: in function `RunBinding'
Interface\FrameXML\WorldMapFrame.lua:262: in function <Interface\FrameXML\WorldMapFrame.lua:259>

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> {
 }
 UNIT_AURA = <function> defined @Interface\AddOns\oUF\elements\aura.lua:209
 RAID_TARGET_UPDATE = <function> defined @Interface\AddOns\oUF\elements\ricons.lua:19
 power = <unnamed> {
 }
 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 = 97218
hMax = 97218
status = nil
hPerc = "100%"
len = 4
(for index) = 1
(for limit) = 4
(for step) = 1
i = 1
digit = "%"
(*temporary) = <function> defined =[C]:-1
(*temporary) = <unnamed> {
 0 = <userdata>
}
(*temporary) = nil
(*temporary) = "%"
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'oUF_Hank' (a nil value)"
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 12-05-11 at 08:10 AM.
  Reply With Quote
12-05-11, 07:57 AM   #4
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Originally Posted by Syliha View Post
Thanks =)

I tried this one out and i think it should go to custom_modifications.lua?

I just copied and pasted it in and added the self.power:Hide(),self.power=nil above: "self.power:ClearAllPoints()"
That will of course error out, because you can't call ClearAllPoints() on nil. Leave it there, but comment out all other occurences of self.power (there are more below). Always enable lua errors when changing stuff, and get yourself Swatter or the like to get good info on the errors.
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-05-11, 03:23 PM   #5
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Not sure if you have seen it, but I have pasted in some errors.
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-05-11, 04:38 PM   #6
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
No, I didn't, I always check for new posts Yeah, you'll need to paste the following at the beginning of the file:

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
}
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-05-11, 08:20 PM   #7
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
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,
}
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-06-11, 04:14 AM   #8
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Yeah you missed 2 occurences of power:

Code:
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
Just turn the above into

Code:
self.RaidIcon:SetPoint("RIGHT", self.name, "LEFT", -10, 0)
Btw, hint: STRG+F or just the "search" function of the editor of your choice is your friend.
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-06-11, 05:46 AM   #9
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
I am so sorry to bother you constantly :/ really... =(

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)
		self.RaidIcon:SetPoint("RIGHT", self.name, "LEFT", -10, 0)
	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,
}
Code:
Message: Interface\AddOns\oUF_Hank_v3\hank_v3.lua:175: attempt to index field 'power' (a nil value)
Time: 12/06/11 12:42:17
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 = 118695
hMax = 118695
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
}
Sorry :/

But I really appreciate you'r help! thank you so much! (:
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-06-11, 06:24 AM   #10
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Do the following to hank_v3.lua.

Replace line 174 by the following:

Code:
elseif self == oUF_target then
Replace line 196 by

Code:
elseif self == oUF_target then
Replace line 240 by the following:
Code:
if not self.power or self.name:GetWidth() >= self.power:GetWidth() then
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-06-11, 06:55 AM   #11
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Hm i guess almost:

http://www.abload.de/img/wowscrnshot_120611_13x9q5p.jpg

The Focus' name is missing now but i get no error.
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-06-11, 07:28 AM   #12
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Why did you delete the setpoint for the name from sharedStyle? I told you to edit it. Look at the code I posted for you and find where it was, then put it back, but change it to

Code:
self.name:SetPoint("BOTTOMRIGHT",  self.health[1], BOTTOMLEFT")
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-06-11, 08:51 AM   #13
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Alright! Working now! No idea why i deleted this line...

So first: THANKS ! =) So MUCH! =)

second: You mentioned the "SetFont" command but there is none of these comments in your code. (God i feel so dumb, cause it's obviously easy).

Thanks hopefully last time
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-06-11, 08:56 AM   #14
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Nice SetFont isn't there, you'll need to put it in with the right arguments. You can put it just after

Code:
	if (unit == "focus") then
in the sharedstyle function.
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-06-11, 10:26 AM   #15
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
YES! =) I got it! Finally! SOOOO MUCH THANKS to you I can't thank you enough for helping an lua noob like me =) really really appreciate it! =)

http://www.abload.de/img/oufim7se.png

Edit:

Ok there is one last thing!

The font is very small if i se the default ouf font (which i want to use cause it's used for the unit frames also!) and if i remember it right wow does not allow fonts bigger than 32 pxl. So how do solve this? (;

Edit2: Nvm, got it =)
__________________
Balance is, when everyone is unhappy.

Last edited by Syliha : 12-06-11 at 10:43 AM.
  Reply With Quote
12-06-11, 12:41 PM   #16
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Great! Imho you should reposition the ToF, but maybe that's just me
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-06-11, 01:49 PM   #17
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Yup already done that =)
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-06-11, 08:34 PM   #18
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Ok I found the hopefully last thing i want to change ^^

It's a simple one as i just have to find where it is located in the ouf lua but i do not know what to look for exactly.



As you see I want to move the line of my "vehicle" (HP and name) down right under my unit frame or a bit lower (so the runes of DK etc. have space, too).

Where too edit what?

Thanks again for everyone helpfull !
__________________
Balance is, when everyone is unhappy.
  Reply With Quote
12-07-11, 03:49 AM   #19
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
I think the vehicle uses the pet name. Can't be done with a custom mod, because you "just" need to move the frame. Edit line 1492 of hank_v3.lua.
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
12-07-11, 05:46 AM   #20
Syliha
A Flamescale Wyrmkin
 
Syliha's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 104
Thanks worked =)

Does the combopoint part count for rogues and druid cats?
__________________
Balance is, when everyone is unhappy.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Personal adjustment for ouf_hank?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off