Thread Tools Display Modes
09-11-12, 09:06 PM   #1
eponine
A Fallenroot Satyr
Join Date: Aug 2012
Posts: 29
oUF help - again

Hello fellow UI enthusiasts,

Need some help with oUF/unit frame LUA again.

http://i.imgur.com/WZnf6.jpg

First, as you can see, on mobs with long names the name extends over the health numbers. Same thing happens on focus/target of target except those will just extend over the length of the bar. Is there any way to limit the number of characters shown, or something?

Second, my pet bar shows as dark reddish brown no matter what I do... I want it to be the same hunter green as my focus bar.

http://i.imgur.com/n8xIo.jpg

Code for target frame:
Code:
local function CreateTargetStyle(self, unit, isSingle)
self.mystyle = "target"
lib.init(self)
self:SetScale(cfg.scale)
self.width = 210
self.height = 34
self:SetSize(self.width,self.height)
lib.gen_hpbar(self)
lib.gen_tagcontainer(self)
lib.gen_hpstrings(self)
lib.gen_highlight(self)
lib.gen_ppbar(self)
lib.gen_RaidMark(self)
self.Health.frequentUpdates = false
self.Health.Smooth = true
if cfg.HealthcolorClass then
self.Health.colorClass = true
self.Health.colorHealth = true
end
self.Power.colorTapping = true
self.Power.colorDisconnected = true
if cfg.Powercolor then
self.Power.colorClass = true
else
self.Power.colorPower = true
end
self.Power.colorReaction = true
self.Power.Smooth = true
lib.gen_castbar(self)
lib.addQuestIcon(self)
lib.createAuras(self)
lib.genCPoints(self)
if cfg.showPortrait then lib.gen_portrait(self) end	
end
Code for pet frame:
Code:
local function CreatePetStyle(self, unit, isSingle)
local _, playerClass = UnitClass("player")
self.mystyle = "pet"
lib.init(self)
self:SetScale(cfg.scale)
self.width = 105
self.height = 12
self:SetSize(self.width,self.height)
lib.gen_hpbar(self)
lib.gen_hpstrings(self)
lib.gen_highlight(self)
lib.gen_RaidMark(self)
self.Health.frequentUpdates = false
self.Health.Smooth = true
if cfg.HealthcolorClass then
self.Health.colorClass = true
self.Health.colorHealth = true
end
There is also a config.lua:
Code:
cfg.HealthcolorClass = false	 -- health color class, false to color health the default color
cfg.Powercolor = true	 -- power color class, false to color power type
But changing these values only messes up the color of my player frames and doesn't change the pet frame at all.


I cannot thank you all enough for the help, my UI has come a long way in the past few weeks!

EDIT: Crap, forgot this one: what is the coding to show a white border around dispellable (purge/tranq) buffs on my target?

Last edited by eponine : 09-11-12 at 10:33 PM.
  Reply With Quote
09-11-12, 11:59 PM   #2
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
This is the relevant part from ouf/health.lua

Code:
elseif(health.colorClass and UnitIsPlayer(unit)) or
(health.colorClassNPC and not UnitIsPlayer(unit)) or
(health.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then
	local _, class = UnitClass(unit)
	t = self.colors.class[class]
So you need to add the following line to the CreatePetStyle function:

Code:
self.Health.colorClassPet = true
Regarding names, you can either use string.len and string.sub to check length and truncate as needed. Or you can explicitly set the fontstring's size with :SetSize() and / or :SetPoint() as you do with any region, essentially setting a maximum length. Anchoring the name's right side to the left side of the health string is how I would do it.
  Reply With Quote
09-12-12, 12:13 AM   #3
eponine
A Fallenroot Satyr
Join Date: Aug 2012
Posts: 29
I added that line to the pet style so it now looks like this:
Code:
	if PlayerClass == "HUNTER" then
		self.Power.colorReaction = false
		self.Power.colorClass = false
		self.Health.colorClassPet = true
	end
Not working, it still shows as a brownish color in-game. Am I doing something wrong?

Regarding names, you can either use string.len and string.sub to check length and truncate as needed. Or you can explicitly set the fontstring's size with :SetSize() and / or :SetPoint() as you do with any region, essentially setting a maximum length. Anchoring the name's right side to the left side of the health string is how I would do it.
Sorry, I have no idea what this means. I should've specified that I'm very new to LUA. Could you be a little more specific? Where exactly am I putting these new functions?
  Reply With Quote
09-12-12, 12:22 AM   #4
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
playerClass shouldn't start with a capital p. That condition always evaluates to false, the original code has that error too. Just stick it in the main function, not inside that condition. Also seems kind of pointless tbh, colorClass should do nothing with pet frames anyway unless you are in a vehicle when you reload and oUF sends real unitID to style functions not just "pet".

Regarding name strings, make a backup of lib.lua, then under lib.gen_hpstrings, replace this:

Code:
local name = lib.gen_fontstring(f.Health, cfg.font, cfg.fontsize, cfg.fontstyle)
name:SetJustifyH("LEFT")
if f.mystyle == "player" then
	local name = lib.gen_fontstring(f.Tagcontainer, cfg.font, cfg.fontsize, cfg.fontstyle)
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	f:Tag(name, "[color][name][afk]")
elseif f.mystyle == "target" then
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	f:Tag(name, "[level] [color][name][afk]")
elseif f.mystyle == "focus" then
	name:SetPoint("LEFT", f.Health)
	f:Tag(name, "[color][name]")
elseif f.mystyle == "raidfordps" then
	name:SetAllPoints(f)
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
elseif f.mystyle == "partyforhealer" or f.mystyle == "raid25" or f.mystyle == "raid40" then
	name:SetPoint("CENTER")
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
else
	name:SetPoint("LEFT")
	f:Tag(name, "[color][name]")
end
With this:

Code:
local name = lib.gen_fontstring(f.Health, cfg.font, cfg.fontsize, cfg.fontstyle)
name:SetJustifyH("LEFT")
if f.mystyle == "player" then
	local name = lib.gen_fontstring(f.Tagcontainer, cfg.font, cfg.fontsize, cfg.fontstyle)
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name][afk]")
elseif f.mystyle == "target" then
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[level] [color][name][afk]")
elseif f.mystyle == "focus" then
	name:SetPoint("LEFT", f.Health)
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name]")
elseif f.mystyle == "raidfordps" then
	name:SetPoint("center", f, "center")
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
elseif f.mystyle == "partyforhealer" or f.mystyle == "raid25" or f.mystyle == "raid40" then
	name:SetPoint("CENTER")
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
else
	name:SetPoint("LEFT")
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name]")
end
This way you can specify a name width for every frame style. I put 50 in each of them as a placeholder, experiment and replace it with whatever number works for you. Any names longer than this width will be automagically truncated by WoW.

I'll get back to you on the rest in a couple of hours, servers are down in Europe.

Last edited by nailertn : 09-12-12 at 02:26 AM. Reason: set height to cfg.fontsize
  Reply With Quote
09-12-12, 02:19 AM   #5
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
Thumbs up

One thing to note about pet frame colour is that pets have their own class. Most of them are considered warriors or paladins IIRC. If you want it green, you should just set it directly in the CreatePetStyle function.

Replace this:

Code:
if PlayerClass == "HUNTER" then
	self.Power.colorReaction = false
	self.Power.colorClass = false
	self.Health.colorClassPet = true
end
With this:

Code:
if playerClass == "HUNTER" then
	local t = self.colors.class[playerClass]
	self.Health:SetStatusBarColor(t[1], t[2], t[3])
end
  Reply With Quote
09-12-12, 03:38 AM   #6
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
And lastly here is the aura border code. Again, make a backup of lib.lua first.

Delete these:

Code:
CreateBorder = function(f,x)
	h = CreateFrame("Frame", nil, f)
	h:SetFrameLevel(1)
	h:SetFrameStrata(f:GetFrameStrata())
	h:SetPoint("TOPLEFT", -x, x)
	h:SetPoint("BOTTOMRIGHT", x, -x)
	h:SetBackdrop(borders)
	h:SetBackdropColor(0.1,0.1,0.1,0.6)
	h:SetBackdropBorderColor(65/255, 74/255, 79/255)
end

local postUpdateIcon = function(element, unit, button, index)
	local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, button.filter)
	
	if duration and duration > 0 then
		button.time:Show()
		button.timeLeft = expirationTime	
		button:SetScript("OnUpdate", setTimer)			
	else
		button.time:Hide()
		button.timeLeft = math.huge
		button:SetScript("OnUpdate", nil)
	end

	if(button.debuff) then
		if(unit == "target") then	
			if (unitCaster == "player" or unitCaster == "vehicle") then
				button.icon:SetDesaturated(false)                 
			elseif(not UnitPlayerControlled(unit)) then -- If Unit is Player Controlled don"t desaturate debuffs
				button:SetBackdropColor(0, 0, 0)
				button.overlay:SetVertexColor(0.3, 0.3, 0.3)      
				button.icon:SetDesaturated(true)  
			end
		end
	end
	button:SetScript('OnMouseUp', function(self, mouseButton)
		if mouseButton == 'RightButton' then
			CancelUnitBuff('player', index)
	end end)
	button.first = true
end
Add these:

Code:
CreateBorder = function(f,x)
	h = CreateFrame("Frame", nil, f)
	h:SetFrameLevel(1)
	h:SetFrameStrata(f:GetFrameStrata())
	h:SetPoint("TOPLEFT", -x, x)
	h:SetPoint("BOTTOMRIGHT", x, -x)
	h:SetBackdrop(borders)
	h:SetBackdropColor(0.1,0.1,0.1,0.6)
	h:SetBackdropBorderColor(65/255, 74/255, 79/255)
	f.something_unique = h
end

local dispell_lists = {
	DRUID = { Curse = true, Poison = true },
	MAGE = { Curse = true },
	PALADIN = { Disease = true, Magic = true, Poison = true },
	PRIEST = { Disease = true, Magic = true },
	SHAMAN = { Curse = true, Disease = true, Poison = true }
}

local dispell_list = dispell_lists[select(2, UnitClass("player"))]

local postUpdateIcon = function(element, unit, button, index)
	local _, _, _, _, debuff_type, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, button.filter)
	
	if duration and duration > 0 then
		button.time:Show()
		button.timeLeft = expirationTime	
		button:SetScript("OnUpdate", setTimer)			
	else
		button.time:Hide()
		button.timeLeft = math.huge
		button:SetScript("OnUpdate", nil)
	end

	if(button.debuff) then
		if(unit == "target") then	
			if (unitCaster == "player" or unitCaster == "vehicle") then
				button.icon:SetDesaturated(false)                 
			elseif(not UnitPlayerControlled(unit)) then -- If Unit is Player Controlled don"t desaturate debuffs
				button:SetBackdropColor(0, 0, 0)
				button.overlay:SetVertexColor(0.3, 0.3, 0.3)      
				button.icon:SetDesaturated(true)  
			end
		end
	end
	button:SetScript('OnMouseUp', function(self, mouseButton)
		if mouseButton == 'RightButton' then
			CancelUnitBuff('player', index)
	end end)
	button.first = true
	
	if unit == "target" and UnitCanAssist("player", "target") and button.debuff and debuff_type and dispell_list and dispell_list[debuff_type] then	
		button.something_unique:SetBackdropBorderColor(1,0,0)
	else
		button.something_unique:SetBackdropBorderColor(65/255, 74/255, 79/255)
	end
end
You have to update the dispell_lists table to MoP because I have no idea what class can dispell what now. It's all drycoded so let me know how it's working. (Changed the code in the previous post about name width too.)

Last edited by nailertn : 09-12-12 at 03:46 AM.
  Reply With Quote
09-12-12, 05:44 AM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by nailertn View Post
Regarding name strings ... This way you can specify a name width for every frame style. I put 50 in each of them as a placeholder, experiment and replace it with whatever number works for you. Any names longer than this width will be automagically truncated by WoW.
An easier method that doesn't require hardcoding a numeric value, assuming you have the name on the left and health on the right:

Code:
local health = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
health:SetPoint("RIGHT", frame, "RIGHT", -4, 0)

local name = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
name:SetPoint("LEFT", frame, "LEFT", 4, 0)
name:SetPoint("RIGHT", health, "LEFT", -4, 0)
This way, the width of the name dynamically changes with the health. When the health gets wider, the name gets narrower, and vice versa. You don't even have to know the total width of the frame.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-12-12, 07:47 AM   #8
eponine
A Fallenroot Satyr
Join Date: Aug 2012
Posts: 29
Sorry guys, I went to bed. But I am checking all of these suggestions out right now. Thanks, will update

Also, thank you for moving this to the oUF forum. I did not even know there was one.

edit: Nailertn, what you suggested for truncating the name worked perfectly. It now says RAIDER'S TRAINING DU... - except for some reason it messed up my player/pet/target frames and I don't know how to fix it. See: http://i.imgur.com/KvVDu.jpg

Have not tried the aura coding yet because I'll need somebody to have dispellable buffs to test it with first, but will try when I can.

I also tried what you said for pet frame color, and while it worked I decided I don't like it, lol it now looks like this: http://i.imgur.com/BGWb0.jpg

So new question, could you tell me what I'd need to change to make my pet frame look like my ToT frame? ie the greyish color and hunter-green text?

@Phanx, will that code stretch the text so it looks narrower, or will it shrink the font to fit? I don't want bunched up text when my target has a super long name, but smaller would be fine.

Thanks guys!

Last edited by eponine : 09-12-12 at 08:39 AM.
  Reply With Quote
09-12-12, 02:33 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by eponine View Post
@Phanx, will that code stretch the text so it looks narrower, or will it shrink the font to fit? I don't want bunched up text when my target has a super long name, but smaller would be fine.
It won't change either the text size or the letter spacing. As far as I know, there isn't a way to change the letter spacing of font strings in WoW; even if there is, this isn't t. Anchoring the way I suggested has exactly the same effect as setting the font string's width explicitly (as in Nailtern's code) except that you don't have to figure out the exact width you want, and you don't have to change the width yourself if you change the frame width, and it will adjust itself on the fly as the font string text changes.

If you wanted to make the text size smaller for units with really long names, you could register for the UNIT_NAME event on your frame, and handle setting the text yourself, instead of using a tag:
Code:
local playerRealm = GetRealmName()

local function UpdateName(frame, event, unit)
	local name, realm = UnitName(unit)
	if realm and realm ~= "" and realm ~= playerRealm then
		name = format("%s-%s", name, realm)
	end
	
	local font, _, outline = frame.Name:GetFont()
	if strlen(name) > 20 then -- change 20 to however many characters usually fit
		frame.Name:SetFont(font, 14, outline) -- small size for long names
	else
		frame.Name:SetFont(font, 18, outline) -- normal size for short names
	end
	
	frame.Name:SetText(name)
end

local function Spawn(frame, unit, single)
	-- do stuff here
	
	frame.Name = frame:CreateFontString()
	-- configure name font string here

	-- register your name update function:
	frame:RegisterEvent("UNIT_NAME_UPDATE", UpdateName)

	-- do more stuff here
end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-12-12, 03:48 PM   #10
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
Originally Posted by eponine View Post
edit: Nailertn, what you suggested for truncating the name worked perfectly. It now says RAIDER'S TRAINING DU... - except for some reason it messed up my player/pet/target frames and I don't know how to fix it. See: http://i.imgur.com/KvVDu.jpg
What do you mean messed up? I don't see anything wrong on that picture. If you mean truncated, that was precisely what you asked for. The code I gave you allows you to set name width on a per frame basis. Pet and target of target frames are set under "else" or if you want to specify just one, add another condition like "elseif f.mystyle = 'pet' then" or "elseif f.mystyle = 'tot' then". If you want the player name aligned left add name:SetJustifyH("LEFT").

Originally Posted by eponine View Post
So new question, could you tell me what I'd need to change to make my pet frame look like my ToT frame? ie the greyish color and hunter-green text?
Change lib.updateHealth to this:

Code:
lib.updateHealth = function(bar, unit, min, max)
	local color, t = {1, 0, 0} 
	if(UnitIsPlayer(unit)) then
	   local _, class = UnitClass(unit)
	   t = bar:GetParent().colors.class[class]
	end
	if(t) then
	   r, g, b = t[1], t[2], t[3]
	elseif unit == "pet" then
		t = oUF.colors.class[select(2, UnitClass("player"))]
		r, g, b = t[1], t[2], t[3]
	else
        r, g, b = 1, 0, 0
	end
	if not cfg.HealthcolorClass then
		bar.bg:SetVertexColor(r, g, b, 0.35)
	else
		bar.bg:SetVertexColor(1, 0.2, 0.2, 0.15)
	end
end
And this is how the bottom part of your lib.gen_hpstrings function should look like with all the changes you asked for:

Code:
local name = lib.gen_fontstring(f.Health, cfg.font, cfg.fontsize, cfg.fontstyle)
name:SetJustifyH("LEFT")
if f.mystyle == "player" then
	local name = lib.gen_fontstring(f.Tagcontainer, cfg.font, cfg.fontsize, cfg.fontstyle)
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(50, cfg.fontsize)
	name:SetJustifyH("LEFT")
	f:Tag(name, "[color][name][afk]")
elseif f.mystyle == "target" then
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[level] [color][name][afk]")
elseif f.mystyle == "focus" then
	name:SetPoint("LEFT", f.Health)
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name]")
elseif f.mystyle == "raidfordps" then
	name:SetPoint("center", f, "center")
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
elseif f.mystyle == "partyforhealer" or f.mystyle == "raid25" or f.mystyle == "raid40" then
	name:SetPoint("CENTER")
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
elseif f.mystyle == "pet" then
	name:SetPoint("LEFT")
	name:SetSize(50, cfg.fontsize)
	name:SetVertexColor(unpack(f.colors.class[select(2, UnitClass("player"))]))
	f:Tag(name, "[name]")
else
	name:SetPoint("LEFT")
	name:SetSize(50, cfg.fontsize)
	f:Tag(name, "[color][name]")
end
Originally Posted by eponine View Post
@Phanx, will that code stretch the text so it looks narrower, or will it shrink the font to fit? I don't want bunched up text when my target has a super long name, but smaller would be fine.
What Phanx said is the same I suggested in my first post and works like the above code in that if a name is too long, the excess gets replaced with ... You get a little more room by using whatever space is not used by the health string instead of setting name width for worst case scenario. But you have to figure out where to anchor the name on a per frame basis as the original code is a bit of a mess with different anchor frames, multiple hp tags etc...

Frankly if you don't know Lua you have to use layouts as they are. People are generally willing to help with basic stuff but you have to make very sure you know exactly what you want. When you ask for multiple implementations just because you don't fancy the first, it is time to learn Lua or switch to more user friendly unit frames.

Last edited by nailertn : 09-12-12 at 06:12 PM.
  Reply With Quote
09-12-12, 04:54 PM   #11
eponine
A Fallenroot Satyr
Join Date: Aug 2012
Posts: 29
Thanks Phanx, I'll try that when I get home.

What do you mean messed up? I don't see anything wrong on that picture. If you mean truncated, that was precisely what you asked for. The code I gave you allows you to set name width on a per frame basis. Pet and target of target frames are set under "else" or if you want to specify just one, add another condition like "elseif f.mystyle = 'pet' then" or "elseif f.mystyle = 'tot' then". If you want the player name aligned left add name:SetJustifyH("LEFT").
The truncated is fine, but it's happening on pet and ToT frames also when I do not see any codes for them. The only specified frames are: player, target, focus, raidfordps, and partyforhealer (the last two are disabled). I will add the code you posted up there asap.

Also I do have the justify code in there but my player name is still appearing in the center, for some reason.

Code:
local name = lib.gen_fontstring(f.Health, cfg.font, cfg.fontsize, cfg.fontstyle)
name:SetJustifyH("LEFT")
if f.mystyle == "player" then
	local name = lib.gen_fontstring(f.Tagcontainer, cfg.font, cfg.fontsize, cfg.fontstyle)
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(155, cfg.fontsize)
	f:Tag(name, "[color][name][afk]")
Frankly if you don't know Lua you have to use layouts as they are. People are generally willing to help with basic stuff but you have to make very sure you know exactly what you want. When you ask for multiple implementations just because you don't fancy the first, it is time to learn Lua or switch to more user friendly unit frames.
Well, I apologize for all the questions, but I literally have no idea where to begin with LUA. I'm definitely willing to learn, it just seems very daunting as I have zero background in coding.

Last edited by eponine : 09-12-12 at 05:10 PM.
  Reply With Quote
09-12-12, 06:17 PM   #12
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
I know how daunting it is, a few years ago I was exactly where you are now: staring at an oUF layout with zero coding knowledge.

Code:
local name = lib.gen_fontstring(f.Health, cfg.font, cfg.fontsize, cfg.fontstyle)
name:SetJustifyH("LEFT") -- this line aligns name to the left on all frames except for player frame
if f.mystyle == "player" then
	local name = lib.gen_fontstring(f.Tagcontainer, cfg.font, cfg.fontsize, cfg.fontstyle)
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(50, cfg.fontsize) -- this line sets name width for player frame
	name:SetJustifyH("LEFT") -- this line aligns name to the left on the player frame
	f:Tag(name, "[color][name][afk]")
elseif f.mystyle == "target" then
	name:SetPoint("BOTTOMLEFT", f.Tagcontainer)
	name:SetSize(50, cfg.fontsize) -- this line sets name width for target frame
	f:Tag(name, "[level] [color][name][afk]")
elseif f.mystyle == "focus" then
	name:SetPoint("LEFT", f.Health)
	name:SetSize(50, cfg.fontsize) -- this line sets name width for focus frame
	f:Tag(name, "[color][name]")
elseif f.mystyle == "raidfordps" then
	name:SetPoint("center", f, "center")
	name:SetSize(50, cfg.fontsize) -- this line sets name width for raid frames
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
elseif f.mystyle == "partyforhealer" or f.mystyle == "raid25" or f.mystyle == "raid40" then
	name:SetPoint("CENTER")
	name:SetSize(50, cfg.fontsize) -- this line sets name width for party frames
	f:Tag(name, "[color][name][afk]")
	name:SetJustifyH("CENTER")
elseif f.mystyle == "pet" then
	name:SetPoint("LEFT")
	name:SetSize(50, cfg.fontsize) -- this line sets name width for pet frames
	name:SetVertexColor(unpack(f.colors.class[select(2, UnitClass("player"))])) -- this line 
	f:Tag(name, "[name]")
else
	name:SetPoint("LEFT")
	name:SetSize(50, cfg.fontsize) -- this line sets name width for any frames not specified above, including target of target frame
	f:Tag(name, "[color][name]")
end

Last edited by nailertn : 09-12-12 at 06:25 PM.
  Reply With Quote
09-12-12, 06:41 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by eponine View Post
The truncated is fine, but it's happening on pet and ToT frames also when I do not see any codes for them. The only specified frames are: player, target, focus, raidfordps, and partyforhealer (the last two are disabled).
You probably added the SetWidth lines from Nailertn's code for every frame. If you don't want to cut off the text on the pet frame, don't change the width of the font string on the pet frame (eg. in the elseif f.mystyle == "pet" then section).

If you're using anchors to control the width, you can anchor the font string to the whole frame to make sure it doesn't spill out of the frame, but not cut it off as long as it's not wider than the frame:

Code:
elseif f.mystyle == "pet" then
	name:SetPoint("LEFT") -- this is already there
	name:SetPoint("RIGHT") -- add this
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-12-12, 08:09 PM   #14
eponine
A Fallenroot Satyr
Join Date: Aug 2012
Posts: 29
Okay, that last bit of code worked perfectly.

Only problem I have now is my pet's name doesn't seem to be showing, OR it is hunter-green so it's not showing on the bar. I replaced that "Change lib.updateHealth to this" code but it didn't change anything.

I realize this are very specific requests, as I'm quite nitpicky about small things, so just let me know if I'm asking too much. Every explanation helps me understand LUA more so eventually I won't have to ask (hopefully)

Thank you so much.

edit: here's what I'm talking about regarding the pet frames: http://i.imgur.com/MNtbo.png
Seems like the font and the bar color are both class-color for my hunter only

edit again: removed the "if hunter" lines from core.lua and that fixed it. See, I'm learning already.

Last edited by eponine : 09-12-12 at 08:33 PM.
  Reply With Quote
09-12-12, 11:44 PM   #15
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
After my second post the servers went live and I have tested everything since then with the version that's available right here on Wowinterface. If you don't get the expected results some other modification you made is interfering or you did not undo the original change you asked for, which it sounds like.
  Reply With Quote
09-13-12, 08:07 AM   #16
eponine
A Fallenroot Satyr
Join Date: Aug 2012
Posts: 29
Everything is working perfectly now

Thank you so much for your help.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF help - again


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