Thread Tools Display Modes
03-17-09, 04:46 PM   #921
Shestak
A Deviate Faerie Dragon
 
Shestak's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 11
Hello. For display of frames I use oUF. It from different examples seen by me has been written. Has adjusted all how it would be desirable for me to see all frames.
Also there was one moment - display defined debuff or buff from the list written by me.

Looked different examples who as does. It has turned out here that:
Code:
oUF.Tags['[ice]'] = function(u) return UnitAura(u, 'Ice Armor')  and "|cff33FF33c|r" end
oUF.TagEvents['[ice]'] = 'UNIT_AURA'

local ice = self.Health:CreateFontString(nil, 'OVERLAY')
ice:SetFont(fontb, 18, 'OUTLINE')	
ice:SetPoint('CENTER', 0, 5)
self:Tag(ice, '[ice]')
Thus the spell and if it is present it is deduced by the text which I have specified above is supervised.

Whether and it is possible at spell occurrence somehow to deduce the text set by me, and its present picture of a spell from game? And how it to make?
As a rough example - tracing of a spell Frost Blast on Kel'Thuzad in Naxxramas.


Thankful in advance for council.

Last edited by Shestak : 03-17-09 at 04:49 PM.
 
03-17-09, 05:07 PM   #922
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by PProvost View Post
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.
oUF uses the return of the tag to determine if the function executed successfully or not. By returning nothing you tell oUF that it shouldn't apply preppend or append any information to the tag if that's defined.
 
03-17-09, 05:30 PM   #923
Druidicbeast
A Fallenroot Satyr
Join Date: Feb 2008
Posts: 24
I've been trying to learn as much as I can from looking at different layouts. I am still pretty new to all of this lua coding.

I wanted to start with just a basic player unit frame to practice and work with. I am having a hard time trying to find just that portion of the code to work with in the layouts. Every time I think I have copied over anything that seems relevant no frame is spawned. Is it possible for someone to enlighten me on maybe basic requirements to spawn just the player frame?

I'm sure my toc and lua files are setup correctly cause if I copy all of the code to a template over to my .lua file that template loads w/ minimal errors due to dir paths not existing for textures and such.

Thank you in advance and sorry if it seems kinda dumb.
 
03-17-09, 06:07 PM   #924
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Allright, there's something that's bothering me now.

Say i use the following tag instead on the Hex() funtion
Code:
oUF.Tags['[gradient]'] = function(unit)
	local min, max = UnitHealth(unit), UnitHealthMax(unit)
  r, g, b = oUF.ColorGradient(min / max, 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
  return string.format('|cff%02x%02x%02x', r*255, g*255, b*255)
end
And then, here's an example of what you can find in my health tag
Code:
return (max > min) and '|cffaf5050'..oUF.Tags['[curhp]'](unit)..'|r'..'|cffD7BEA5 - |r'..oUF.Tags['[perhp]'](unit)..'%|r'
Then finally
Code:
self:Tag(self.hvalue, '[gradient][health]')
the first part of my health line above is [curhp] but i'm giving it a custom fixed color, then there's the - and finally [perhp] which is without any custom coloring

So i'm assuming [perhp] will get the [gradient], but it doesn't, why ?

Whenever i manually set the color of something nothing that comes after that will get the gradient, even if i payed close attention to close everything with |r as suggested.

EDIT: Also, this code does a memory leak in the layout, making it go up to 1+meg in raids.

Code:
function PostUpdateAuraIcon(self, icons, unit, icon, index, offset, filter, isDebuff)
	icon:SetScript('OnMouseUp', function(self, mouseButton)
		if(mouseButton == 'RightButton' and not isDebuff and unit == 'player') then
			CancelUnitBuff('player', index)
		end
	end)
end
This is the only efficient way i've found to have a flawlessly working right click buffs cancelling. If i move it to the PostCreateAuraIcon and use button instead of icon then i can't check for unit == 'player' and ofc i can then cancel my own buffs by clicking on any frame.
Does anyone know a workaround, a way to have it working without memory leak ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 03-19-09 at 08:48 AM.
 
03-17-09, 06:39 PM   #925
PProvost
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 13
Originally Posted by Druidicbeast View Post
I've been trying to learn as much as I can from looking at different layouts. I am still pretty new to all of this lua coding.

I wanted to start with just a basic player unit frame to practice and work with. I am having a hard time trying to find just that portion of the code to work with in the layouts. Every time I think I have copied over anything that seems relevant no frame is spawned. Is it possible for someone to enlighten me on maybe basic requirements to spawn just the player frame?

I'm sure my toc and lua files are setup correctly cause if I copy all of the code to a template over to my .lua file that template loads w/ minimal errors due to dir paths not existing for textures and such.

Thank you in advance and sorry if it seems kinda dumb.
You can try mine: oUF_Quaiche

It is pretty well commented and fairly simple.
 
03-18-09, 11:49 AM   #926
Lysiander
An Aku'mai Servant
Join Date: Dec 2007
Posts: 37
Hi there,

im having trouble with some of my Tags not updating properly and was hoping someone could enlighten me. Essentially, I have written tags that check the player for certain raidbuffs and show a reminder if one is missing. (The concept is that if there is someone in the raid who should be buffing you, but isn't, the tag will tell you.)
It all works fine and dandy, however, the updates only occur when a unit aura changes, despite the fact that I have also listed
RAID_ROSTER_UPDATE
PARTY_MEMBERS_CHANGED
as events for the tag. Code is a bit cluttered, but it should be readable:

Code:
	local function isRaid()
		if GetNumRaidMembers() > 0 then return true else return false end
	end
	
	local function classcount(buffclass)
		local count = 0
			for i = 1, GetNumRaidMembers() do
				_, _, _, _, _, fileName, zone, online = GetRaidRosterInfo(i)
				if fileName == buffclass and online == 1 then count = count +1 end
			end
			if class == buffclass then count = count -1 end
			return count
	end
	
	local function bos(buffclass)
		local count = classcount(buffclass)
			for i = 1,40 do
				name = UnitAura('player', i, 'HELP')
				if name == 'Greater Blessing of Sanctuary' then count = count -1 else end
			end
		return count
	end
Code:
 
oUF.Tags['[PalaB2]'] = function(u) if isRaid() then
    if bos('PALADIN') >= 2 then 
	if class == 'DRUID' then
	if (not UnitAura(u, 'Blessing of Might') and not UnitAura(u, 'Greater Blessing of Might')) then return 'BoM' else return '' end
	else 
	if (not UnitAura(u, 'Blessing of Wisdom') and not UnitAura(u, 'Greater Blessing of Wisdom')) then return 'BoW' else return '' end
	end
	end
	end
end
Code:
	oUF.TagEvents['[PalaB2]'] = 'UNIT_AURA RAID_ROSTER_UPDATE PARTY_MEMBERS_CHANGED'
This is only one example tag. It does work fine, it just doesn't update when someone leaves the raid, joins the raid or goes linkdead, which is rather important to me. Anyone got any pointers?
 
03-19-09, 10:56 AM   #927
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 ?
 
03-19-09, 11:00 AM   #928
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
I don't understand your question coree.
 
03-19-09, 06:00 PM   #929
Krag72
A Deviate Faerie Dragon
Join Date: Sep 2008
Posts: 14
I think Coree's problem might be that sometimes the safezone is drawn on top of the cast bar and sometimes not. I seem to recall having that happen in some iteration of my layout, but I can't recall what I did to make sure the cast bar was always "on top" and I can't find any real differences in the code.
 
03-20-09, 07:04 AM   #930
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by Krag72 View Post
I think Coree's problem might be that sometimes the safezone is drawn on top of the cast bar and sometimes not. I seem to recall having that happen in some iteration of my layout, but I can't recall what I did to make sure the cast bar was always "on top" and I can't find any real differences in the code.
yes thats what i mean

can you post your code plz?
 
03-20-09, 07:35 AM   #931
Krag72
A Deviate Faerie Dragon
Join Date: Sep 2008
Posts: 14
This is what I use for my current old layout. Though as I said I can't really spot any differences.

Code:
        -- Player castbar
	    local cb = CreateFrame("StatusBar")
        cb:SetBackdrop(
            {bgFile = [[Interface\ChatFrame\ChatFrameBackground]], 
            insets = {top = -1.5, left = -1.5, bottom = -1.5, right = -1.5}}
            )
	    cb:SetBackdropColor(0, 0, 0, 0.75)
	    cb:SetWidth(220)
	    cb:SetHeight(25)
	    cb:SetStatusBarTexture(tex)
	    cb:SetStatusBarColor(1, 1, 0)
	    cb:SetParent(self)
	    cb:SetPoint("TOPRIGHT", self, "TOPLEFT", -20, 0)
	    cb:SetMinMaxValues(1, 100)
	    cb:SetValue(1)
	    cb:Hide()
	    self.Castbar = cb
		
	    local cbbg = cb:CreateTexture(nil, "BORDER")
	    cbbg:SetAllPoints(cb)
	    cbbg:SetTexture(tex)
	    cbbg:SetVertexColor(0, 0, 0, 0.75)
	    cb.bg = cbbg

	    local cbtime = cb:CreateFontString(nil, "OVERLAY")
	    cbtime:SetPoint("RIGHT", cb, -2, 1)
	    cbtime:SetFont(font, 12, "OUTLINE")
	    cbtime:SetTextColor(1, 1, 1)
	    cbtime:SetJustifyH("RIGHT")
	    cb.Time = cbtime

	    local cbtext = cb:CreateFontString(nil, "OVERLAY")
	    cbtext:SetPoint("LEFT", cb, 2, 1)
	    cbtext:SetPoint("RIGHT", cb.Time, "LEFT", -10, 0)
	    cbtext:SetFont(font, 12, "OUTLINE")
	    cbtext:SetTextColor(1, 1, 1)
	    cbtext:SetJustifyH("LEFT")
	    cb.Text = cbtext

    	local cbsafe = cb:CreateTexture(nil,"ARTWORK")
	    cbsafe:SetTexture(tex)
	    cbsafe:SetVertexColor(0.33, 0.59, 0.33, 0.75)
	    cbsafe:SetPoint("TOPRIGHT")
	    cbsafe:SetPoint("BOTTOMRIGHT")
	    cb.safezone = cbsafe

	    local cbicon = cb:CreateTexture(nil, "ARTWORK")
	    cbicon:SetPoint("LEFT", cb, -29, 0)
	    cbicon:SetHeight(25)
	    cbicon:SetWidth(25)
	    cbicon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
	    cb.Icon = cbicon

        cbbg = self.Castbar:CreateTexture(nil, "OVERLAY")
        cbbg:SetTexture(textureborder)
        cbbg:SetVertexColor(0.2, 0.2, 0.2)
        cbbg:SetPoint("TOPLEFT", cbicon, "TOPLEFT", -2, 2)
        cbbg:SetPoint("BOTTOMRIGHT", cbicon, "BOTTOMRIGHT", 2, -2)
        cb.bg = cbbg
 
03-20-09, 10:55 AM   #932
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Haste could you plz take a look at this when you have a second ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
03-21-09, 02:46 AM   #933
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Caellian View Post
Haste could you plz take a look at this when you have a second ?
1. You can't nest color tags afaik.
2. PostUpdateAuraIcon is executed on every aura update, so using that is just a bad idea.

There are a couple of things you should do. The first is to move the function outside the general layout code:
Code:
local cancelAura = function(self, button)
    if(button == 'RightButton' and not self.debuff) then
        CancelUnitBuff('player', self:GetID())
    end
end
The next thing is to only apply this to the player frame with PostCreateAuraIcon(). I don't know how the rest of your layout looks, so I'm assuming you have other stuff in that function already. What you have to add to your function is then:
Code:
if(self.unit == 'player') then
    button:SetScript('OnMouseUp', cancelAura)
end
I'm also assuming that you are using self.Auras. This solution will work fine for self.Buffs also however .
 
03-21-09, 03:57 AM   #934
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
Originally Posted by coree View Post
how can i prevent that the castbar will be overlapped sometimes by the castbar safezone?
I fixed it by simply creating the safezone texture as "BORDER":
Code:
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"BORDER")
 
03-21-09, 07:57 AM   #935
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
1. You can't nest color tags afaik.
Oh that's too bad really because using the Hex function make the tag lines 1 mile long

For the cancel buff, thanks a lot, it works like a charm now, that was really driving me nuts to have it working but with a memory leak
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
03-22-09, 03:35 PM   #936
nidraj
A Deviate Faerie Dragon
Join Date: Dec 2008
Posts: 10
Hi everybody

in this tag

Code:
self:Tag(self.Info, '[name]')
how can I make to color the name in classcolor ?

thx

Last edited by nidraj : 03-22-09 at 03:37 PM.
 
03-22-09, 03:37 PM   #937
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by nidraj View Post
Hi everybody

in this tag

Code:
self:Tag(self.Info, '[name]')
how can I make to colour the name in classcolor ?

thx
'[raidcolor][name]'

(too short)
 
03-22-09, 03:56 PM   #938
nidraj
A Deviate Faerie Dragon
Join Date: Dec 2008
Posts: 10
Originally Posted by p3lim View Post
'[raidcolor][name]'

(too short)
ok .. very easy

I have search without finding ... I am ashamed

thx P3lim =)
 
03-23-09, 04:48 AM   #939
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by Luzzifus View Post
I fixed it by simply creating the safezone texture as "BORDER":
Code:
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"BORDER")
then the safezone is under the background :/
 
03-23-09, 07:08 AM   #940
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
Not if you create the SafeZone after the Background. Also you can always set a frame-level to have it on top of the BG.

This is my whole castbar-code and it works perfectly:
Code:
self.Castbar = CreateFrame("StatusBar")
self.Castbar:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", insets ={left = -1, right = -1, top = -1, bottom = -1}})
self.Castbar:SetBackdropColor(nivDB.colorBD.r, nivDB.colorBD.g, nivDB.colorBD.b, nivDB.colorBD.a)
self.Castbar:SetWidth(nivcfgDB.castbarWidth)
if (unit=="player") then
	self.Castbar:SetHeight(20)
	self.Castbar:SetPoint("CENTER", UIParent, "CENTER", nivcfgDB.castbarX, nivcfgDB.castbarY)
else
	self.Castbar:SetHeight(10)
	self.Castbar:SetPoint("CENTER", UIParent, "CENTER", nivcfgDB.castbarX, nivcfgDB.castbarY - 17)
end
self.Castbar:SetStatusBarTexture(nivDB.texStrHealth)
self.Castbar:SetStatusBarColor(nivcfgDB.colorHealth.r, nivcfgDB.colorHealth.g, nivcfgDB.colorHealth.b, nivvcfgDB.colorHealth.a)	
self.Castbar:SetParent(self)
self.Castbar:SetMinMaxValues(1, 100)
self.Castbar:SetValue(1)
self.Castbar:Hide()  
self.Castbar.bg = self.Castbar:CreateTexture(nil, "BORDER")
self.Castbar.bg:SetAllPoints(self.Castbar)
self.Castbar.bg:SetTexture("Interface\\AddOns\\oUF_Nivaya\\textures\\Minimalist")
self.Castbar.bg:SetAlpha(0.05)	
self.Castbar.Time = self.Castbar:CreateFontString(nil, "OVERLAY")
self.Castbar.Time:SetPoint("RIGHT", self.Castbar, -2, 0)
self.Castbar.Time:SetFont(nivDB.fontStrValues, nivcfgDB.fontHeightV)
self.Castbar.Time:SetTextColor(1, 1, 1)
self.Castbar.Time:SetJustifyH("RIGHT")
self.Castbar.Text = self.Castbar:CreateFontString(nil, "OVERLAY")
self.Castbar.Text:SetPoint("LEFT", self.Castbar, 2, 0)
self.Castbar.Text:SetWidth(240)
self.Castbar.Text:SetFont(nivDB.fontStrNames, nivcfgDB.fontHeightN)
self.Castbar.Text:SetTextColor(1, 1, 1)
self.Castbar.Text:SetJustifyH("LEFT")
		
if (unit=="player") then
	self.Castbar.Time:SetTextHeight(nivcfgDB.fontHeightV+2)
	self.Castbar.Text:SetTextHeight(nivcfgDB.fontHeightN+2)			
else
	self.Castbar.Time:SetTextHeight(nivcfgDB.fontHeightV)
	self.Castbar.Text:SetTextHeight(nivcfgDB.fontHeightN)			
end

self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,"BORDER")
self.Castbar.SafeZone:SetTexture(nivDB.texStrHealth)
self.Castbar.SafeZone:SetVertexColor(1,1,1,0.7)
self.Castbar.SafeZone:SetPoint("TOPRIGHT")
self.Castbar.SafeZone:SetPoint("BOTTOMRIGHT")

Last edited by Luzzifus : 03-23-09 at 12:30 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