Thread Tools Display Modes
02-26-09, 11:38 AM   #821
lanacan
A Warpwood Thunder Caller
 
lanacan's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 94
Question about PvP Tags just so I'm clear as I'm new to coding in lua and using the oUF Tags.

If I want to have the text the pvp tag returns show i would do this to initiate the tag in the layout:

Code:
 
if (pvpicons) then
        oUF.Tags['[pvp]'] = function(u) return UnitIsPVP(u) and "PvP" end
        oUF.TagEvents['[pvp]'] = 'UNIT_FACTION'
end
Then place this below to make the tag visible correct (inside health on raid frames):
Code:
if (pvpicons) then
        local pvpFlag = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
        pvpFlag:SetPoint('LEFT', 3, 0)
        self:Tag(pvpFlag, '[pvp]')
end
How would I change the second part so I could place the text outside of the unitframe on the left or right side?

I'm looking to add them to the following frames:
- player (right side outside of frame top of text inline with top edge of frame)
- target (same as player but on the left side)
- pet (just above the frames top left corner)


Thank you
__________________
Busy modifying your code for my own UI.
 
02-26-09, 12:11 PM   #822
Alkar
A Chromatic Dragonspawn
 
Alkar's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 195
Originally Posted by lanacan View Post
Question about PvP Tags just so I'm clear as I'm new to coding in lua and using the oUF Tags.

If I want to have the text the pvp tag returns show i would do this to initiate the tag in the layout:

Code:
 
if (pvpicons) then
        oUF.Tags['[pvp]'] = function(u) return UnitIsPVP(u) and "PvP" end
        oUF.TagEvents['[pvp]'] = 'UNIT_FACTION'
end
Then place this below to make the tag visible correct (inside health on raid frames):

Code:
if (pvpicons) then
        local pvpFlag = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
        pvpFlag:SetPoint('LEFT', 3, 0)
        self:Tag(pvpFlag, '[pvp]')
end
How would I change the second part so I could place the text outside of the unitframe on the left or right side?

I'm looking to add them to the following frames:
- player (right side outside of frame top of text inline with top edge of frame)
- target (same as player but on the left side)
- pet (just above the frames top left corner)


Thank you


I think it would then look like this

if (pvpicons) then
local pvpFlag = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
pvpFlag:SetPoint('LEFT', 'UiParent', 'LEFT', 3, 0)
self:Tag(pvpFlag, '[pvp]')
end
__________________
 
02-26-09, 12:15 PM   #823
lanacan
A Warpwood Thunder Caller
 
lanacan's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 94
Originally Posted by Alkar View Post
I think it would then look like this

if (pvpicons) then
local pvpFlag = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
pvpFlag:SetPoint('LEFT', 'UiParent', 'LEFT', 3, 0)
self:Tag(pvpFlag, '[pvp]')
end
Code:
self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
That is the part I'm not sure of same with using "UIParent".
I don't think that is the proper way of attaching it to the unit frame.
__________________
Busy modifying your code for my own UI.
 
02-26-09, 12:41 PM   #824
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Code:
        local pvpFlag = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
        pvpFlag:SetPoint('LEFT', 3, 0)
The :SetPoint() is the same as:
Code:
        pvpFlag:SetPoint('LEFT', pvpFlag, 'LEFT', 3, 0)
To throw it outside the frame you have to do:
Code:
        pvpFlag:SetPoint('RIGHT', self, 'LEFT', 3, 0)
 
02-26-09, 12:46 PM   #825
lanacan
A Warpwood Thunder Caller
 
lanacan's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 94
Originally Posted by haste View Post
Code:
        local pvpFlag = self.Health:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightLeft')
        pvpFlag:SetPoint('LEFT', 3, 0)
The :SetPoint() is the same as:
Code:
        pvpFlag:SetPoint('LEFT', pvpFlag, 'LEFT', 3, 0)
To throw it outside the frame you have to do:
Code:
        pvpFlag:SetPoint('RIGHT', self, 'LEFT', 3, 0)
Thanks Haste!
__________________
Busy modifying your code for my own UI.
 
02-26-09, 12:56 PM   #826
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Caellian View Post
Now in case it is the second one:

is it possible to merge oUF original Hex function (with the string) with this one ?
Based on how your function looks (ie. dynamic function calling) - I would say no. The hex function in oUF is there to convert colors into strings for text, while your function is there for a generalized coloring function.

Regarding the two solutions - I would call the second one cleaner.
 
02-27-09, 12:31 PM   #827
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 308
Originally Posted by Freebaser View Post
Is it possible to have castbar timers to countdown to 0?
I've been looking for info on what I can change in oUF to make castbars count downward instead of upward.
 
02-27-09, 12:49 PM   #828
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Haste answered that question on the same page with

You can do it with self:CustomDelayText() and self:CustomTimeText()
and an example was given a few pages down

Code:
            self.Castbar.CustomTimeText = function(self, duration)
                if self.casting then
                    self.Time:SetFormattedText("%.1f", self.max - duration)
                elseif self.channeling then
                    self.Time:SetFormattedText("%.1f", duration)
                end
            end
 
02-27-09, 12:50 PM   #829
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 308
Originally Posted by Freebaser View Post
Haste answered that question on the same page with



and an example was given a few pages down

Code:
            self.Castbar.CustomTimeText = function(self, duration)
                if self.casting then
                    self.Time:SetFormattedText("%.1f", self.max - duration)
                elseif self.channeling then
                    self.Time:SetFormattedText("%.1f", duration)
                end
            end
Hm, somehow I missed it.. must've skimmed and scrolled too fast! Thanks!


Instead of double posting I'll just edit this post....

Does anyone know how to make all my units name stay uppercase? I used string.upper in the overridenameupdate function provided in neavs style and it does work for the most part. As I said over in the comments to his style all the names get converted to uppercase except for the tot. The tot goes from Name to NAME over and over. Suggestions?

Last edited by Tim : 02-27-09 at 02:41 PM.
 
02-27-09, 09:27 PM   #830
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
Based on how your function looks (ie. dynamic function calling) - I would say no. The hex function in oUF is there to convert colors into strings for text, while your function is there for a generalized coloring function.

Regarding the two solutions - I would call the second one cleaner.
Apparently there would even be an easier way, i've found this to be working just fine, and as i wasnt' using the Hex function anywhere else:

Code:
local function UpdateColor(self, element, unit, func)
	if(UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit)) then
		r, g, b = colors.disconnected
	elseif(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
		r, g, b = colors.tapped
	elseif(unit == 'player' or unit == 'pet') then
		local num, str = UnitPowerType(unit)
		r, g, b = colors.power[str]
	elseif(UnitIsPlayer(unit)) then
		local _, class = UnitClass(unit)
		r, g, b = colors.class[class]
	else
		local reaction = UnitReaction(unit, 'player')
		r, g, b = FACTION_BAR_COLORS[reaction]
	end

	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

	if(not r or not g or not b) then r, g, b = 1, 1, 1 end

	if(func == 'SetVertexColor') then
		element[func](element, r * .33, g * .33, b * .33)
	else
		element[func](element, r, g, b)
	end
end
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 02-28-09 at 04:43 AM.
 
03-01-09, 06:18 AM   #831
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Oh hi, again

Allright, i'm trying something here, have a backdrop colored around my frames to replace the default self.Threat, and it works, well, in a weird way.

This is the function
Code:
local function OverrideUpdateThreat(self, event, unit)
	local isTanking, state, scaledPercent, rawPercent, threatValue = UnitDetailedThreatSituation("player", unit)
		if threatValue then
			r, g, b = self.ColorGradient(scaledPercent/100, .33,.59,.33, .65,.63,.35, .69,.31,.31)
			self.Threat:SetBackdropBorderColor(r,g,b)
			self.Threat:Show()
		else
			self.Threat:Hide()
		end
end
Code:
		self.Threat = CreateFrame('Frame', nil, self)
		self.Threat:SetPoint('TOPLEFT', self, 'TOPLEFT', -4, 4)
		self.Threat:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 4.5, -4.5)
--		self.Threat:SetFrameStrata('BACKGROUND')
		self.Threat:SetBackdrop({
		  edgeFile = 'Interface\\AddOns\\oUF_Caellian\\media\\glowTex', edgeSize = 5,
		  insets = {left = 3, right = 3, top = 3, bottom = 3}
		})
It appears to me to be correct, but once ingame, it's the hostile unit that's getting the backdrop glowing (target, or target of target if i target my pet), and the coloring seems correct aswell, but it should be my frame or even my pet frame affected, not my target. It's like if it was working the opposite way it should.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 03-01-09 at 07:21 AM. Reason: typos
 
03-01-09, 07:38 AM   #832
Krag72
A Deviate Faerie Dragon
Join Date: Sep 2008
Posts: 14
Originally Posted by Caellian View Post
It appears to me to be correct, but once ingame, it's the hostile unit that's getting the backdrop glowing (target, or target of target if i target my pet), and the coloring seems correct aswell, but it should be my frame or even my pet frame affected, not my target. It's like if it was working the opposite way it should.
I haven't looked much into it, but as far as I can recall the event is fired on the mob on which the threat changes occur, so the "self" you have is the mob I think.
 
03-01-09, 07:44 AM   #833
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
What i'm trying is to replicate the exact same behavior as the default oUF threat module, but instead of coloring a texture, i want it to color that backdrop i'm creating around the frames.

I've changed to UnitDetailedThreatSituation(unit, 'target')
Seems to work a bit better but, say i send my pet in combat nothing happen, i have to engage the mob myself only then it start working correctly, and even after a feign death, then but only then the pet gets aggro colored.

Edit: well it seems that's also how the default oUF threat works, but that's weird.

Actually made it a lot simpler.

Code:
local function OverrideUpdateThreat(self, event, unit)
	local status = UnitThreatSituation(unit)
		if(status > 0) then
			r, g, b = GetThreatStatusColor(status)
			self.Threat:SetBackdropBorderColor(r, g, b)
			self.Threat:Show()
		else
			self.Threat:Hide()
		end
end
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 03-01-09 at 09:39 AM.
 
03-01-09, 11:40 AM   #834
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Caellian View Post
What i'm trying is to replicate the exact same behavior as the default oUF threat module, but instead of coloring a texture, i want it to color that backdrop i'm creating around the frames.

I've changed to UnitDetailedThreatSituation(unit, 'target')
Seems to work a bit better but, say i send my pet in combat nothing happen, i have to engage the mob myself only then it start working correctly, and even after a feign death, then but only then the pet gets aggro colored.

Edit: well it seems that's also how the default oUF threat works, but that's weird.

Actually made it a lot simpler.

Code:
local function OverrideUpdateThreat(self, event, unit)
	local status = UnitThreatSituation(unit)
		if(status > 0) then
			r, g, b = GetThreatStatusColor(status)
			self.Threat:SetBackdropBorderColor(r, g, b)
			self.Threat:Show()
		else
			self.Threat:Hide()
		end
end
This is how I did it: http://github.com/p3lim/ouf_mini/com...8cdf6157290a93
oUF required 'self.Threat' so instead I made my own
 
03-02-09, 08:27 AM   #835
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Just started dabbling with creating an oUF layout, using p3lims as a base (thanks p3lim).

I color my healthbar in my PostUpdateHealth-function, with slightly different coloring depending on for example what unit it is and if the unit is hostile and so on. However, I noticed that oUF_Banzai doesn't color any other bars than for the player.

Could this be because I'm coloring the bar continually in the updatehealth-function and thus overriding the Banzai-coloring?

Also, I realize I'm setting the color of the bar probably more than needed (only need to do this once really - when the target/targettarget changes), can I do it another way to only set it once? I tried looking at other layouts but it seems I'm applying more 'rules' to my coloring than most so not really getting any ideas from that.

Guess it's more of a logic-problem for me than code.
 
03-02-09, 12:00 PM   #836
lanacan
A Warpwood Thunder Caller
 
lanacan's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 94
Question on showing Raid Icons for raid member's targets.

I know P3lim made the following tag:

Code:
--Instantiation
oUF.Tags['[assisticon]'] = function(u) return GetRaidTargetIndex(u..'target') and ICON_LIST[i]..'22|t' end

--Event 
oUF.TagEvents['[assisticon]'] = 'UNIT_TARGET RAID_TARGET_UPDATE'


--Display In Unit Frame
self:Tag(name, '[name( )][leader( )][offline( )][afk( )]|cff00ffff[(- )assistname( )][assisticon]')
Lately though It is causing an error, I thought it was due to a custom change I made adding a pvp flag (via ouf pvp tag) to the raid frames but that is not the case.

I'm at a loss on how to correct this and would like to get the icons working again.

I tried using older ouf versions to see if that was a cause but i still got the same error.

Any suggestions?
__________________
Busy modifying your code for my own UI.
 
03-03-09, 01:56 AM   #837
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Originally Posted by Ailae View Post
I color my healthbar in my PostUpdateHealth-function, with slightly different coloring depending on for example what unit it is and if the unit is hostile and so on. However, I noticed that oUF_Banzai doesn't color any other bars than for the player.

Could this be because I'm coloring the bar continually in the updatehealth-function and thus overriding the Banzai-coloring?
oUF_Banzai is set to ignore target, targettarget, and targettargettarget.

Lately though It is causing an error, I thought it was due to a custom change I made adding a pvp flag (via ouf pvp tag) to the raid frames but that is not the case.

I'm at a loss on how to correct this and would like to get the icons working again.

I tried using older ouf versions to see if that was a cause but i still got the same error.

Any suggestions?
Error message would be nice
 
03-03-09, 04:42 AM   #838
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Originally Posted by Freebaser View Post
oUF_Banzai is set to ignore target, targettarget, and targettargettarget.
Ahh, ok - didn't know that. Guess I should've looked a bit closer at the Banzai code. Thanks!
 
03-03-09, 10:25 AM   #839
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
I've had that weird idea to add a backdrop to my buffs/debuffs buttons.
I've tried different ways, creating an invisible frame with a backdrop, adding a backdrop to the buttons themselves, but that didn't quite work.

So hmm the question is, is that even possible, basically add a backdrop on buffs/debuffs buttons like i did on normal frames ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
03-03-09, 03:44 PM   #840
fauxpas
A Defias Bandit
Join Date: Sep 2006
Posts: 3
Hey everyone, I got a slight problem with my modified ouf_Ammo layout (used the latest version from wowace, also using latest version of oUF from curse):

In the default ouf_Ammo, the buffs are shown at the bottom left whereas the debuffs are shown at the top right. I want the buffs to stay at the very same position but i want the debuffs to be directly below them.

Consequently, i changed the SetPoint-thingy for the debuffs to "anchor" it to the buffs-frame:

Code:
debuffs:SetPoint("TOPLEFT", buffs, "BOTTOMLEFT",0,-5)
The problem is that this remains static so that when there are lots of buffs and there are 2 or 3 rows of them, they begin to overlap as can be seen here:
http://www.abload.de/img/wowscrnshot_030109_230yo5t.jpg
(note that i didn't use the -5px here but more)

Now i went to irc and stolenlegacy was kind enough to help. He tried adding a function (he is well aware that this isnt good style and all but he didn't really know ouf well but still was kind enough to try and help me)

Code:
local function updateBuffFrame(self, event, unit)
	 if ammo_debuffs and ammo_buffs then
		ammo_debuffs:ClearAllPoints();
		ammo_debuffs:SetPoint("TOPLEFT", ammo_buffs, "BOTTOMLEFT",0,-5);
	end
end
this is called (i presume, i hardly know lua and wow api stuff ) in the function setStyle by "self.UNIT_AURA = updateBuffFrame"

Adding this function however just hides any buffs and debuffs without giving any kind of lua error

As a reference, here is the current "positioning" code:

Code:
	if unit and not unit:find("party%dtarget") and not unit:find("partypet%d") then
		local buffs = CreateFrame("Frame", nil, self)
		buffs.size = buffheight
		buffs:SetHeight(buffheight)
		buffs:SetWidth(buffwidth)
		buffs:SetPoint("TOPLEFT", self, "BOTTOMLEFT",-1.5, -3)
		buffs.initialAnchor = "TOPLEFT"
		buffs["growth-y"] = "DOWN"
		buffs.num = 40
		if unit == "player" or unit== "targettarget" or unit == "focus" then buffs.num = 0 end
		self.Buffs = buffs

		local debuffs = CreateFrame("Frame", nil, self)
		ammo_buffs = buffs
		ammo_debuffs = debuffs
		debuffs.size = buffheight
		debuffs:SetHeight(buffheight)
		debuffs:SetWidth(buffwidth)
	
		debuffs:SetPoint("TOPLEFT", buffs, "BOTTOMLEFT",0,-5)
		debuffs.initialAnchor = "TOPLEFT"
		debuffs["growth-y"] = "DOWN"
		debuffs["growth-x"] = "RIGHT"
		debuffs.num = 40
		if unit == "player" or unit== "targettarget" or unit == "focus" then debuffs.num = 0 end
		self.Debuffs = debuffs
anyone got an idea how that could work the way i want it to?


and as another annoying bonus question (it's not too important) from someone who loves ouf but probably shouldn't use it: is it possible to increase the scale of the debuffs you caused on the target? i have aurasort and somehow made it show them first but a slight increase in scale would probably be easier to see

Last edited by fauxpas : 03-03-09 at 03:47 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