View Single Post
07-18-10, 09:14 AM   #39
Icerat
A Fallenroot Satyr
Join Date: Sep 2006
Posts: 28
Learning a little more now, getting my head around it slowly, i have the following which displays the name at a set distance from the left of the frame,

For player and target its 28 from left as so that I can get player / target lvl (80+ for example) in before the name with out any over lap.

For Pet and focus and tot I don't display the lvl on them frames so it 0 from left.

Code:
 --gen name string func
  	lib.gen_namestring = function(f)
	--name text string
		local name = lib.gen_fontstring(f.Health, cfg.font, 9, "THINOUTLINE")
			if f.mystyle == "player" then
				name:SetPoint("LEFT", f.Health, "LEFT",28, 10)
				elseif f.mystyle == "target" then
				name:SetPoint("LEFT", f.Health, "LEFT",28, 10)
				name:SetWidth(100)
				else
				name:SetPoint("LEFT", f.Health, "LEFT", 0, 10)
			end
		f:Tag(name, "[name]")
	end
The problem I had was that if the target has a long name it would over lap the [curhp]/[maxhp] I have on the same line top right.

I thought that if I used name:SetWidth(100) it would cause the name to be cut off but instead it moves my / target name over to the right and if the target has a long name it stacks/word wraps it so you have the first part of name on top and the rest directly underneath it.

I apologize in advance if the code is terrible I'm only just learning.

Mike
  Reply With Quote