Quantcast oUF - Layout discussion - Page 46 - WoWInterface
Thread Tools Display Modes
03-17-09, 02:04 AM   #901
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Could use some quick help with this:

Been attempting to convert my health function to tags, this is only a part of it:

Code:
oUF.Tags['[health]'] = function(unit) 
	if unit == 'player' then
		return (UnitHealthMax(unit) > UnitHealth(unit)) and '|cffaf5050'..oUF.Tags['[curhp]'](unit)..'|r' or '|cff559655'..oUF.Tags['[maxhp]'](unit)..'|r'
	elseif unit == 'target' then
		return (UnitHealthMax(unit) > UnitHealth(unit)) and '|cffaf5050'..oUF.Tags['[shorthealth]'](unit)..'|r' or '|cff559655'..oUF.Tags['[shorthealth]'](unit)..'|r'
	else
		return (UnitHealthMax(unit) > UnitHealth(unit)) and '' or '|cff559655'..oUF.Tags['[shorthealth]'](unit)..'|r'
	end
end
The only thing i didn't manage to convert is my gradient for texts:

Code:
r, g, b = self.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
Static colors are quite simple but what about a gradient, how ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 03-17-09 at 03:11 AM.
 
03-17-09, 08:38 AM   #902
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,019
Just feed the returns of that function to Hex() and have it convert it?

Also tags shouldn't return empty strings (ie. ""/'').
 
03-17-09, 09:14 AM   #903
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
Just feed the returns of that function to Hex() and have it convert it?

Also tags shouldn't return empty strings (ie. ""/'').
Feed the return of the tag above the the Hex function and have it convert it.

I don't understand

About the empty string, how else can i have it display "nothing" then.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
03-17-09, 09:27 AM   #904
Balkeep
A Cyclonian
 
Balkeep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 43
Is that only me or its some kind of bugg?
When im trying to use filters on Auras, lets say
self.Auras.Filter = "HELPFULL|RAID"
i get TWO icons of each buff...

Also 1 more question, when i was trying to use taggs for my mana textfields i found out that .FrequentUpdates doesnt work with it. Am i doing something wrong?
 
03-17-09, 09:32 AM   #905
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,019
Originally Posted by Caellian View Post
Feed the return of the tag above the the Hex function and have it convert it.

I don't understand
A short example would be:
Code:
local min, max = UnitHealth(unit), UnitHealthMax(unit)
return Hex(self.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33))
Originally Posted by Caellian View Post
About the empty string, how else can i have it display "nothing" then.
By returning nothing
 
03-17-09, 09:35 AM   #906
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,019
Originally Posted by Balkeep View Post
Is that only me or its some kind of bugg?
When im trying to use filters on Auras, lets say
self.Auras.Filter = "HELPFULL|RAID"
i get TWO icons of each buff...
1. It's self.Auras.filter
2. It's HELPFUL|RAID
3. The filter argument is handled on the Blizzard side.

Originally Posted by Balkeep View Post
Also 1 more question, when i was trying to use taggs for my mana textfields i found out that .FrequentUpdates doesnt work with it. Am i doing something wrong?
1. It's .frequentUpdates
2. By default it's throttled at .5 across the board on tags.
3. It can be a number, but using that will make all OnUpdate tag update at that speed. See two for the default speed.
 
03-17-09, 09:41 AM   #907
Balkeep
A Cyclonian
 
Balkeep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 43
Ye, well, sorry i made some mistakes cuz i was just typing that w/o seeing a code, thou it express what i was trying to say pretty well =P
Okay i got the answers, will experiment some more then.
 
03-17-09, 10:01 AM   #908
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
how can i prevent that the castbar will be overlapped sometimes by the castbar safezone.

Code:
self.Castbar = CreateFrame("StatusBar", nil, self)
self.Castbar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -21)
self.Castbar:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -21)
self.Castbar:SetStatusBarTexture(texture2)
self.Castbar:SetStatusBarColor(0.2705882352941176, 0.407843137254902, 0.5450980392156862)
self.Castbar:SetBackdrop(backdrop)
self.Castbar:SetBackdropColor(0, 0, 0)
self.Castbar:SetHeight(15)
self.Castbar:SetWidth(300)
self.Castbar:SetToplevel(true)

self.Castbar.Time = SetFontString(self.Castbar, fontn, 14, "THINOUTLINE")
self.Castbar.Time:SetPoint("RIGHT", self.Castbar, -3, 1)
self.Castbar.Time:SetJustifyH("RIGHT")
self.Castbar.CustomTimeText = OverrideCastbarTime

self.Castbar.Text = SetFontString(self.Castbar, fontn, 14, "THINOUTLINE")
self.Castbar.Text:SetPoint("LEFT", self.Castbar, 3, 1)
self.Castbar.Text:SetPoint("RIGHT", self.Castbar.Time, "LEFT")

self.Castbar.bg = self.Castbar:CreateTexture(nil, "BORDER")
self.Castbar.bg:SetAllPoints(self.Castbar)
self.Castbar.bg:SetTexture(0.3, 0.3, 0.3)
		
if(cbarsafe == true and unit == "player") then
	self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"ARTWORK")
	self.Castbar.SafeZone:SetTexture(texture2)
	self.Castbar.SafeZone:SetVertexColor(.69,.31,.31)
	self.Castbar.SafeZone:SetPoint("TOPRIGHT")
	self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT")
end
any idea ?

Last edited by coree : 03-19-09 at 10:56 AM.
 
03-17-09, 10:38 AM   #909
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
I'm sorry haste but i really don't get how to put this together, the goal being to have the oUF.Tags['[perhp]'](unit) to be gradient colored

Code:
local function Hex(r, g, b)
	if type(r) == "table" then
		if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
	end

	return string.format("|cff%02x%02x%02x", r*255, g*255, b*255)
end
Code:
oUF.Tags['[perchealth]'] = function(unit) 
		return (UnitHealthMax(unit) > UnitHealth(unit)) and oUF.Tags['[perhp]'](unit) or ''
end
Code:
local min, max = UnitHealth(unit), UnitHealthMax(unit)
return Hex(self.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33))
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
03-17-09, 10:46 AM   #910
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
If it has to be something like this which look quite weird to me:

Code:
oUF.Tags['[perchealth]'] = function(unit) 
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
	if UnitHealthMax(unit) > UnitHealth(unit) then
		return Hex(self.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33))..oUF.Tags['[perhp]'](unit)
	end
end
Then

Code:
oUF_cTags.lua:33: attempt to index global 'self' (a nil value)
But i guess that's not how it's supposed to be.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 03-17-09 at 10:46 AM. Reason: Typo
 
03-17-09, 10:49 AM   #911
Balkeep
A Cyclonian
 
Balkeep's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 43
1 more noob question...
If i have updateName AND updateHealth in my layout i just call updateName from updateHealth, and then create a link on updateHealth like
self.PostUpdateHealth = updateHealth
But what if i dont have PostUpdateHealth in layout, how should i call updateName then? In some1s layout ive seen something like
self.UNIT_NAME_UPDATE(thats not exact refference =P) = updateName, but it doesnt work for me =(

Also... Back to filters. My Auras code:
Code:
self.Auras = CreateFrame("Frame", nil, self)
self.Auras.initialAnchor = "TOPLEFT"
self.Auras["growth-y"] = "DOWN"
self.Auras:SetHeight(220)
self.Auras:SetWidth(180)
self.Auras.size = 21
self.Auras.spacing = 1
self.Auras.filter = "PLAYER"
self.Auras:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -27, -30)
and i get this as a result:


So its blizzard problem, right?

Last edited by Balkeep : 03-17-09 at 11:22 AM.
 
03-17-09, 11:21 AM   #912
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,019
Originally Posted by Caellian View Post
If it has to be something like this which look quite weird to me:

Code:
oUF.Tags['[perchealth]'] = function(unit) 
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
	if UnitHealthMax(unit) > UnitHealth(unit) then
		return Hex(self.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33))..oUF.Tags['[perhp]'](unit)
	end
end
Then

Code:
oUF_cTags.lua:33: attempt to index global 'self' (a nil value)
But i guess that's not how it's supposed to be.
You have to create a local reference to the function, or access it through oUF.ColorGradient. You should also add |r to mark the end of your color.

Another thing you should do is to use the local variables you create, and not call the Unit* function again.

Originally Posted by Balkeep View Post
1 more noob question...
If i have updateName AND updateHealth in my layout i just call updateName from updateHealth, and then create a link on updateHealth like
self.PostUpdateHealth = updateHealth
But what if i dont have PostUpdateHealth in layout, how should i call updateName then? In some1s layout ive seen something like
self.UNIT_NAME_UPDATE(thats not exact refference =P) = updateName, but it doesnt work for me =(
The following will do what you want:
Code:
self:RegisterEvent('UNIT_NAME_UPDATE', updateName)
table.insert(self.__elements, updateName)
What this does is registering the event to your function (which makes it update if the name changes while you have the unit targeted). The second line inject your function to the table oUF uses to do full updates on a frame (which happens when a frame is shown). It's also the table oUF uses on eventless units to do updates.
 
03-17-09, 11:27 AM   #913
Jabar
Premium Member
 
Jabar's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 8
Originally Posted by Caellian View Post
If it has to be something like this which look quite weird to me:

Code:
oUF.Tags['[perchealth]'] = function(unit) 
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
	if UnitHealthMax(unit) > UnitHealth(unit) then
		return Hex(self.ColorGradient(min/max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33))..oUF.Tags['[perhp]'](unit)
	end
end
Then

Code:
oUF_cTags.lua:33: attempt to index global 'self' (a nil value)
But i guess that's not how it's supposed to be.
This error occurs because you shouldn't use self.ColorGradient inside a Tag but oUF.ColorGradient .

Edit: haste owned me
 
03-17-09, 11:34 AM   #914
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
You have to create a local reference to the function, or access it through oUF.ColorGradient
Ahh yes, thanks a lot <3
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
03-17-09, 01:06 PM   #915
demitri
A Fallenroot Satyr
Join Date: Jul 2008
Posts: 20
how and where would i got to find out SpellID's...
 
03-17-09, 01:08 PM   #916
demitri
A Fallenroot Satyr
Join Date: Jul 2008
Posts: 20
and a MAJOR noob question... is no-lib more lightweight? but still keeps functionality of the addon?
 
03-17-09, 01:46 PM   #917
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,019
Originally Posted by demitri View Post
how and where would i got to find out SpellID's...
This is really unrelated to oUF, but you could look at the id in the URL on DB sites such as wowhead.
Originally Posted by demitri View Post
and a MAJOR noob question... is no-lib more lightweight? but still keeps functionality of the addon?
And this question I don't understand.
 
03-17-09, 03:27 PM   #918
demitri
A Fallenroot Satyr
Join Date: Jul 2008
Posts: 20
how some addons hve libaries.. and then the same addon has none.. i want to know if it loss any fuunctionality
 
03-17-09, 04:12 PM   #919
mikma
A Cyclonian
 
mikma's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 45
haste should ACE it imho. Lots of benefits!
 
03-17-09, 04:44 PM   #920
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 13
Originally Posted by haste View Post
By returning nothing
So a tag that doesn't produce text should return nil or not return at all instead of returning an empty string?

I've been using "" and it hasn't failed me so far.
 

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