Thread Tools Display Modes
10-05-10, 04:23 PM   #61
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Originally Posted by Eveigh View Post
Started to mess around with oUF and your layout.
One thing bugs me a lot - if I "declare" a text in a "lib.lua", i can't attach actual text tag to it in "core.lua".
In "lib.lua", tags are attached simple:
Code:
f:Tag(name, "[name]")
However, when i try to do it in "core.lua" like this:
Code:
self.Tag(name, "[curhp]")
It just won't show me anything. I'm kind of lost.
Help me, please :3
Is the . in self.Tag(...) a typo or does your code actually say that? 'Cause there's a difference.
__________________
Oh, the simulated horror!
  Reply With Quote
10-05-10, 04:24 PM   #62
Eveigh
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Ugh, well, it was namespace issue. I think I figured it out. Dumb me.
But I have another problem: for some reason the following:
Code:
		
if UnitPowerType("target") == 0 
then DoSomething
else DoSomethingElse
end
Would always DoSomething, like UnitPowerType always returns zero, even on warriors, rogues and DKs. What's the problem here?

Edit: well I guess also got it - it checks OnLoad, but I need to check this condition when i change targets. Any way to do it?
Edit2: figured out how to do that also. Well, i'm kind of dumb.

Last edited by Eveigh : 10-05-10 at 04:43 PM.
  Reply With Quote
10-06-10, 02:20 AM   #63
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
So everything OK?
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
10-06-10, 06:07 AM   #64
Eveigh
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Yeah.
If you're interested, this is how it looks now:
Screenie
Another screenie
I reused Elen's textures and font, they look awesome. Also, his code was well written and easy to understand. I asked him if it is ok to upload my layout, giving him credits ofc, but he didn't respond since then. Well, I'll wait :3
Now I'll try to implement party and raid frames. Well...
  Reply With Quote
10-06-10, 09:05 AM   #65
drakull
A Cyclonian
 
drakull's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 49
Trying to figure out how to implement holy power, soul shards, etc...
Will be an 4.x update version of ouf_simple?

Last edited by drakull : 10-06-10 at 09:16 AM.
  Reply With Quote
10-06-10, 09:29 AM   #66
Eveigh
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Looks like i'm in trouble again. This time i'm lost.
I have this code
Code:
local function menu(self)
	local unit = self.unit:sub(1, -2)
	local cunit = self.unit:gsub("(.)", string.upper, 1)
	
	if( UnitIsUnit(self.unit, "player") ) then
		ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor")
	elseif( self.unit == "pet" or self.unit == "vehicle" ) then
		ToggleDropDownMenu(1, nil, PetFrameDropDown, "cursor")
	elseif( self.unit == "target") then
		ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor")
	elseif( self.unitType == "boss" ) then
		ToggleDropDownMenu(1, nil, _G["Boss" .. self.unitID .. "TargetFrameDropDown"], "cursor")
	elseif( self.unit == "focus" ) then
		ToggleDropDownMenu(1, nil, FocusFrameDropDown, "cursor")
	elseif(unit == "party" or unit == "raid") then
		ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor", 0, 0)
	else ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor", 0, 0)
	end
end
It works for player, focus, pet, target, party, raid, but not for my targetoftarget. I don't fully understand how does it work so please, can someone give me advice?
Thanks!
  Reply With Quote
10-06-10, 10:07 AM   #67
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by drakull View Post
Trying to figure out how to implement holy power, soul shards, etc...
Will be an 4.x update version of ouf_simple?

Here is a link to what I had to add to my own layout:

Soul Shards

Holy Power

Phase Icon

Eclipse Bar ** this has yet to be finalised in oUF

Quest Icon ** this has yet to be finalised in oUF

Heal Prediction ** now included within oUF
  Reply With Quote
10-06-10, 10:17 AM   #68
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by Eveigh View Post
Looks like i'm in trouble again. This time i'm lost.
I have this code
Code:
snip
It works for player, focus, pet, target, party, raid, but not for my targetoftarget. I don't fully understand how does it work so please, can someone give me advice?
Thanks!
I use the following code, give it a try:
Code:
local function menu(self)
	local dropdown = _G[format('%sFrameDropDown', gsub(self.unit, '(.)', upper, 1))]

	if dropdown then
		ToggleDropDownMenu(1, nil, dropdown, 'cursor')
	elseif (self.unit:match('party')) then
		ToggleDropDownMenu(1, nil, _G[format('PartyMemberFrame%dDropDown', self.id)], 'cursor')
	else
		FriendsDropDown.unit = self.unit
		FriendsDropDown.id = self.id
		FriendsDropDown.initialize = RaidFrameDropDown_Initialize
		ToggleDropDownMenu(1, nil, FriendsDropDown, 'cursor')
	end
end
  Reply With Quote
10-06-10, 10:21 AM   #69
Eveigh
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 6
Originally Posted by yj589794 View Post
I use the following code, give it a try:
Code:
skip
Gives me
Code:
bMessage: Interface\AddOns\oUF_Jir\jir.lua:124: bad argument #3 to 'gsub' (string/function/table expected)
Time: 10/06/10 22:21:17
Count: 6
Stack: [C]: in function `gsub'
Interface\AddOns\oUF_Jir\jir.lua:124: in function `handler'
Interface\FrameXML\SecureTemplates.lua:529: in function `SecureActionButton_OnClick'
Interface\FrameXML\SecureTemplates.lua:570: in function <Interface\FrameXML\SecureTemplates.lua:562>

Locals: (*temporary) = "player"
(*temporary) = "(.)"
(*temporary) = nil
(*temporary) = 1
No matter what frame I click.
  Reply With Quote
10-06-10, 10:58 AM   #70
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
ahhh, right. I'd added shortcuts to common string functions. change the first line to:

Code:
local dropdown = _G[string.format('%sFrameDropDown', string.gsub(self.unit, '(.)', string.upper, 1))]


edit:
Just noticed that my menu function is not working for targettarget either, and I'm sure it used to work. Time for some debugging...

edit2:
Am I imagining ever having a drop down menu for targettarget??? :/

Last edited by yj589794 : 10-06-10 at 11:14 AM. Reason: blarg
  Reply With Quote
10-06-10, 11:48 AM   #71
drakull
A Cyclonian
 
drakull's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 49
Originally Posted by yj589794 View Post
Here is a link to what I had to add to my own layout:

Soul Shards

Holy Power

Phase Icon

Eclipse Bar ** this has yet to be finalised in oUF

Quest Icon ** this has yet to be finalised in oUF

Heal Prediction ** now included within oUF
Thanks a lot!
Have updated ouf from the github and added SoulShards and HolyPower to my layout.

Now while testing it in the PTR I noted a problem, my power tag is updating on heath changes and not on power changes, and I did'nt changed anything else on my code.

I think it's an oUF issue, but here is my custom tag/tagEvent, just in case I'm missing something:
Code:
oUF.Tags['drk:power']  = function(u) 
	local min, max = UnitPower(u), UnitPowerMax(u)
	if min~=max then 
		return SVal(min).."/"..SVal(max)
	else
		return SVal(max)
	end
end
oUF.TagEvents['drk:power'] = 'UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER'
Edit: nevermind, yj589794 just pointed me to the right direction:
* The UNIT_{MANA|RAGE|ENERGY|FOCUS|HAPPINESS|RUNIC_POWER} events, and their associated UNIT_MAX* counterparts are now deprecated in favor of the single UNIT_POWER and UNIT_MAXPOWER event. The first argument is the unit, the second is the power type, etc.
Took from: http://forums.worldofwarcraft.com/th...99864&sid=2000

Last edited by drakull : 10-06-10 at 12:01 PM.
  Reply With Quote
10-29-10, 09:39 AM   #72
Berb
A Deviate Faerie Dragon
 
Berb's Avatar
Join Date: Nov 2008
Posts: 15
Thanks for the tutorial, zork. I've managed get almost everything the way I want, except for the castbar. I'm trying to color the castbar by class. Every layout I look at seems to use a single color for it so I'm wondering if someone could help me with this.
  Reply With Quote
10-29-10, 09:50 AM   #73
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
You would need to add self.Castbar.PostCastStart and self.Castbar.PostChannelStart functions into your layout. (These can actually be the same function)

Within these routines you can then query the unit class type and then colour the castbar accordingly.

e.g.
Code:
local function myPostCastStart(element, unit, spellname, spellrank, castid)
      -- do checks here and colour the cast bar
end
and in the style function:
Code:
self.Castbar.PostCastStart = myPostCastStart
self.Castbar.PostChannelStart = myPostCastStart
  Reply With Quote
10-29-10, 10:23 AM   #74
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
yj589794 you sure you need a post update for that? I have an option in my layout to color it by class and I don't use the PostCastUpdate to achive that.

When I'm defining the Castbar for the player I defined:

lua Code:
  1. if(cfg.player_castbar_classColor) then fr.Castbar:SetStatusBarColor(unpack(raidColor('player'))) else fr.Castbar:SetStatusBarColor(unpack(cfg.player_castbar_color)) end

And it works just fine.

Regarding the Castbar, I was trying to "emulate" some Castbar addons that color the castbar Red or so when our cast it's interrupted for several reasons (target out of range, interrupt, cancel spell, etc...). Well I can color the Castbar fin with PostCastCancel (or whatever it is called). Problem is the Bar isn' there to be displayed anyway so no effect is visible. Normally those addons allow some fading on the castbar on such thing happens. Would it be possible to recreate something like this or... "Too much Work, forget it!" ?
__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 10-29-10 at 10:27 AM.
  Reply With Quote
10-29-10, 11:01 AM   #75
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
What you posted will work fine for your own castbar, but for dynamic units like 'target' you will need to do Post*Start functions.


As for the stuff you are trying to do, neverg, take a look at the wiki entry. I spent quite a bit of time updating the callback info for all the elements, and it should give you an idea of what is available.
  Reply With Quote
10-29-10, 11:27 AM   #76
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Originally Posted by yj589794 View Post
What you posted will work fine for your own castbar, but for dynamic units like 'target' you will need to do Post*Start functions.


As for the stuff you are trying to do, neverg, take a look at the wiki entry. I spent quite a bit of time updating the callback info for all the elements, and it should give you an idea of what is available.
Fair enough, I only tried it on the Player Castbar, that is why it's always works because you always know your class, makes sense.

And thanks, going to give a look at it.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
10-29-10, 03:11 PM   #77
Zilver
A Fallenroot Satyr
 
Zilver's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 29
Originally Posted by Eveigh View Post
Looks like i'm in trouble again. This time i'm lost.
I have this code
Code:
skip
It works for player, focus, pet, target, party, raid, but not for my targetoftarget. I don't fully understand how does it work so please, can someone give me advice?
Thanks!
Blizzard's TargetofTarget frame doesn't have a dropdown menu, which might be the reason that it won't produce one for you .... well this was the case last time I checked.
  Reply With Quote
10-29-10, 05:22 PM   #78
Berb
A Deviate Faerie Dragon
 
Berb's Avatar
Join Date: Nov 2008
Posts: 15
Originally Posted by yj589794 View Post
e.g.
Code:
local function myPostCastStart(element, unit, spellname, spellrank, castid)
      -- do checks here and colour the cast bar
end
Thanks for the reply, but how exactly do I color it by class? I tried the following from looking at other layouts:
Code:
lib.myPostCastStart = function(self, element, unit, spellname, spellrank, castid)
	local _, class = UnitClass(unit)
	r,g,b = self.colors.class[class]
	self:SetStatusBarColor(r,g,b)
end
There's at least one error here which is "cannot find 'colors' (a nil value)".
  Reply With Quote
10-29-10, 06:16 PM   #79
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by Berb View Post
Thanks for the reply, but how exactly do I color it by class? I tried the following from looking at other layouts:
Code:
lib.myPostCastStart = function(self, element, unit, spellname, spellrank, castid)
	local _, class = UnitClass(unit)
	r,g,b = self.colors.class[class]
	self:SetStatusBarColor(r,g,b)
end
There's at least one error here which is "cannot find 'colors' (a nil value)".
you've got the function parameters incorrect, the first parameter will be the element (self.Castbar), rather than the base object (self).

do something like this:
Code:
lib.myPostCastStart = function(element, unit, spellname, spellrank, castid)
	local _, class = UnitClass(unit)
	r,g,b = element.__owner.colors.class[class]
	element:SetStatusBarColor(r,g,b)
end
you also need to consider error conditions, like when the unit has no class, and give a fallback colour .

Last edited by yj589794 : 10-29-10 at 07:02 PM. Reason: change the code to remove a potentially confusing use of self
  Reply With Quote
10-29-10, 07:20 PM   #80
Berb
A Deviate Faerie Dragon
 
Berb's Avatar
Join Date: Nov 2008
Posts: 15
Awesome. The texture was black, but I changed the colors line to:
Code:
r,g,b = unpack(element.__owner.colors.class[class])
Seems to be fine now.

As for conditions, I believe this will do the trick:
Code:
lib.myPostCastStart = function(element, unit, spellname, spellrank, castid)
	if(UnitIsPlayer(unit)) then
		local _, class = UnitClass(unit)
		r, g, b = unpack(element.__owner.colors.class[class])
	else
		r, g, b = UnitSelectionColor(unit)
	end

        element:SetStatusBarColor(r,g,b)
end

Last edited by Berb : 10-29-10 at 07:28 PM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF tutorial layout for oUF 1.4


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