Thread Tools Display Modes
12-04-08, 10:32 AM   #281
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Originally Posted by p3lim View Post
First off, your code is far from readable, took me a bit to read that piece of code.

Try the following
Code:
local color
if(UnitIsPlayer(unit)) then
	local localized, english = UnitClass(unit)
	color = self.colors.class[english]
else
	color = UnitSelectionColor(unit)
end

self.Health.bg:SetVertexColor(unpack(color))

if(self.Portraitglosst) then
	self.Portraitglosst:SetVertexColor(unpack(color))
end
I've been working on cleaning my code up for a while and my health update is the final bit to do :P

Tried it but getting the error: bad argument #1 to 'unpack' (table expected, got number)
 
12-04-08, 10:58 AM   #282
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by ObbleYeah View Post
I've been working on cleaning my code up for a while and my health update is the final bit to do :P

Tried it but getting the error: bad argument #1 to 'unpack' (table expected, got number)
wups, forgot how UnitSelectionColor returned

Code:
local color
if(UnitIsPlayer(unit)) then
	local localized, english = UnitClass(unit)
	color = self.colors.class[english]
else
	color = {UnitSelectionColor(unit)}
end

self.Health.bg:SetVertexColor(unpack(color))

if(self.Portraitglosst) then
	self.Portraitglosst:SetVertexColor(unpack(color))
end
 
12-04-08, 11:03 AM   #283
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by p3lim View Post
wups, forgot how UnitSelectionColor returned

Code:
local color
if(UnitIsPlayer(unit)) then
	local localized, english = UnitClass(unit)
	color = self.colors.class[english]
else
	color = {UnitSelectionColor(unit)}
end

self.Health.bg:SetVertexColor(unpack(color))

if(self.Portraitglosst) then
	self.Portraitglosst:SetVertexColor(unpack(color))
end
I wouldn't create a table, why not just pass UnitSelectionColor directly to SetVertexColor?
 
12-04-08, 11:22 AM   #284
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Slakah View Post
I wouldn't create a table, why not just pass UnitSelectionColor directly to SetVertexColor?
For such a small function, maybe youre right.

I use return values for my color function.
 
12-04-08, 11:35 AM   #285
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Originally Posted by p3lim View Post
wups, forgot how UnitSelectionColor returned

Code:
local color
if(UnitIsPlayer(unit)) then
	local localized, english = UnitClass(unit)
	color = self.colors.class[english]
else
	color = {UnitSelectionColor(unit)}
end

self.Health.bg:SetVertexColor(unpack(color))

if(self.Portraitglosst) then
	self.Portraitglosst:SetVertexColor(unpack(color))
end
Beautiful, thanks.
 
12-04-08, 12:57 PM   #286
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
New issue, using a custom tag but it's not doing what i want it to

Code:
oUF.Tags['[missinghp]']  = function(u) if min~=max then return UnitHealthMax(u) - UnitHealth(u) else return "" end end  

oUF.TagEvents["[missinghp]"]   = "UNIT_HEALTH UNIT_MAXHEALTH"
I want it to display missing hp and not show at 0, but it's still showing when min=max. Can't work out what i've got wrong here >.<
 
12-04-08, 12:59 PM   #287
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by ObbleYeah View Post
New issue, using a custom tag but it's not doing what i want it to

Code:
oUF.Tags['[missinghp]']  = function(u) if min~=max then return UnitHealthMax(u) - UnitHealth(u) else return "" end end  

oUF.TagEvents["[missinghp]"]   = "UNIT_HEALTH UNIT_MAXHEALTH"
I want it to display missing hp and not show at 0, but it's still showing when min=max. Can't work out what i've got wrong here >.<
What is min and what is max? its not stated anywhere!
 
12-04-08, 01:01 PM   #288
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Oh jesus >.<
I think i need to go lie down for a while :P
 
12-04-08, 08:23 PM   #289
Adalyn
A Kobold Labourer
Join Date: Apr 2008
Posts: 1
I'm some crazy person doing crazy stuffs.

anyways im trying to create statusbars for target debuffs and from what I can tell I have the code correct, but I could be wrong.

Code:
local auraUpdate = function(self, icons, unit, icon, index, offset, filter, isDebuff)
	local name, rank, texture, count, dtype, duration, timeLeft, isPlayer = UnitAura(unit, index, "HARMFUL|PLAYER")
	
	icon.bar:SetMinMaxValues(0, duration)
	icon.bar:SetValue(timeLeft - GetTime())
end

local auraBar = function(self, button, index, isDebuff)
	local count = button.count
	count:ClearAllPoints()
	count:SetPoint("BOTTOM")
	
	local bar = CreateFrame("StatusBar", nil, button)
	bar:SetWidth(100)
	bar:SetHeight(button.icon:GetHeight())
	bar:SetStatusBarTexture(horizont)
	bar:SetBackdrop{
		bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16,
		insets = {left = -1.5, right = -1.5, top = -1.5, bottom = -1.5},
	}
	bar:SetBackdropColor(0, 0, 0, 0.4)
	bar:SetPoint("LEFT", button.icon, "RIGHT", 0, 0)

	button.bar = bar
	
	button.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
end
the debuffs icon shows up, and the duration cooldown shows up fine, but no statusbar. adding print(timeLeft - GetTime()) to the auraUpdate function sucessfully prints what the statusbar value should be....
 
12-05-08, 02:10 AM   #290
Blood Druid
A Fallenroot Satyr
Join Date: Oct 2008
Posts: 26
Originally Posted by p3lim View Post
Use custom templates as shown in the xml file in oUF.
Templates can be added as the 3rd argument to oUF:Spawn()

Yes, I saw this parametr and saw that it is possible to use custom templates, but I really do not understand as it to make

You can set an example?

Last edited by Blood Druid : 12-05-08 at 02:24 AM.
 
12-06-08, 09:18 AM   #291
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Hey, new question :P
I'm trying to be able to select my target via clicking on the portrait as well as clicking on the statusbars. I know Roth has managed this but his code is seriously chunky and looking through it hasn't helped me one bit :<

Anyone know what i would have to do for this?
 
12-07-08, 12:31 PM   #292
Icerat
A Fallenroot Satyr
Join Date: Sep 2006
Posts: 28
I don't know much about coding, but i get the general idea of bits of the code for the amended version of oUF_Lyn im playing and learning with.

How hard would it be to add the mirror bar to my layout? Same style as me cast and target bar.

What do i need to add? Is it possible?
 
12-07-08, 12:41 PM   #293
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Icerat View Post
I don't know much about coding, but i get the general idea of bits of the code for the amended version of oUF_Lyn im playing and learning with.
Why mess with oUF when you have no clue about Lua?
Yes, I understand it could be some starting point, but still?
Stick to PitBull or something.


Originally Posted by Icerat View Post
How hard would it be to add the mirror bar to my layout? Same style as me cast and target bar.

What do i need to add? Is it possible?
I can tell you this, it wont be easy based on your lack of knowledge.
Also, mirror bars has nothing to do with UnitFrames, so oUF also has nothing that helps or supports it, you'd have to make them from scratch.


For help tho, there is an addon called oMirrorBars, which is made by the same author as oUF, haste.
 
12-07-08, 05:23 PM   #294
Icerat
A Fallenroot Satyr
Join Date: Sep 2006
Posts: 28
Why mess with oUF when you have no clue about Lua? Yes, I understand it could be some starting point, but still? Stick to PitBull or something.
I wanted something that was cleaner and alot more light weight, I really like Lyns layout but wanted to customize it to something nearer my taste, on the most part i have been successful. I also enjoy a challenge of learning something new.

I can tell you this, it wont be easy based on your lack of knowledge.
Also, mirror bars has nothing to do with UnitFrames, so oUF also has nothing that helps or supports it, you'd have to make them from scratch.
Where would you suggest i look to improve my knowledge? I'm not afraid to lean new skills.

For help tho, there is an addon called oMirrorBars, which is made by the same author as oUF, haste.
I came across this addon and like the cleanness of the bar, if i could figure out how to add a cast duration / countdown timer it would be great.

Im only trying to learn and all help given is apreciated.

Last edited by Icerat : 12-07-08 at 05:30 PM.
 
12-11-08, 02:49 PM   #295
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
One last issue. I'm looking for a way to set max characters on an info string, otherwise, as you can see on the screenshot(http://i34.tinypic.com/2yvmdrb.jpg), overlapping happens with long names I can't find a way to do it on wowwiki. Does anybody know how i would go about doing it?
 
12-11-08, 02:53 PM   #296
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by ObbleYeah View Post
One last issue. I'm looking for a way to set max characters on an info string, otherwise, as you can see on the screenshot(http://i34.tinypic.com/2yvmdrb.jpg), overlapping happens with long names I can't find a way to do it on wowwiki. Does anybody know how i would go about doing it?
string.sub
 
12-11-08, 02:54 PM   #297
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Setting a width on the fontstring is the easies solution. You could also use string.sub, or a version that also supports utf-8 encoded characters.
 
12-11-08, 02:55 PM   #298
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Originally Posted by p3lim View Post
string.sub
<3. Your punctuality is scary sometimes :P

Setting a width on the fontstring is the easies solution.
This seems even simpler, thanks <3
 
12-11-08, 02:56 PM   #299
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by haste View Post
Setting a width on the fontstring is the easies solution. You could also use string.sub, or a version that also supports utf-8 encoded characters.
Setting a width gives you dots in the string.
 
12-11-08, 03:13 PM   #300
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
So it would seem. Getting this into a tag is annoying though with my knowledge of code.

Code:
oUF.Tags['[name]']       = function(u) return string.sub(value.unit, -3) end
Is what I have but it's blowing out errors.

Edit: Interface\AddOns\oUF_obbleGrid\layout.lua:25:bad argument #1 to 'sub'(string expected, got nil) is the error

Last edited by ObbleYeah : 12-11-08 at 03:18 PM.
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF - Layout discussion

Thread Tools
Display Modes

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