Closed Thread
 
Thread Tools Display Modes
Old 10-09-08, 03:26 PM   #61
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 268
Originally Posted by haste View Post
Not to be completely evil (but quite a bit). Think about exactly what you logically want to do (all the steps of hooking and calling), and what you are doing now.

Or put in another way: Explain to yourself exactly what your code does every time you execute those two functions.
Made it a bit cleaner, now trying to get what you mean, hmmm
The first self shouldn't be there, it affect the unitframe instead of the exp bar frame maybe, but if it's not there it doesn't work at all... hmmm

Code:
			self:SetScript("OnEnter", function(self)
				local origOnEnter = self.Experience:GetScript("OnEnter")
				self.Experience:SetScript('OnEnter', function(self,...) self:SetAlpha(1) origOnEnter(self, ...) end)
			end)

			self:SetScript("OnLeave", function(self)
				local origOnLeave = self.Experience:GetScript("OnLeave")
				self.Experience:SetScript('OnLeave', function(self, ...) self:SetAlpha(0) origOnLeave(self,...) end)
			end)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Caellian is offline  
Old 10-09-08, 03:37 PM   #62
Alanor
A Murloc Raider
Join Date: Oct 2008
Posts: 8
Originally Posted by haste View Post
A easy way to debug it is by doing the following on your header:
Code:
local Hide = party.hide
party.Hide = function(self) ChatFrame1:AddMessage(debugstack()) Hide(self) end
Then you just have to analyze the debug stack :).
Thanks haste, it worked! I can't make any sense of the output though:

Code:
 in function `Hide'
Interface\\FrameXML\\SecureStateDriver.lua:74: in function <Interface\\FrameXML\\SecureStateDriver.lua:62>
Interface\\FrameXML\\SecureStateDriver.lua:109: in function <Interface\\FrameXML\\SecureStateDriver.lua:79>
I was hoping some addon/function name will pop in the debug stack, but it's only the Blizzard code. So it's still a mystery for me. :p

I guess it's got nothing to do with oUF, probably either something I do or another addon, so I feel kinda bad asking about this in the oUF thread. If you think it's derailing, you can just ignore it, but of course any advice would be appreciated!
Alanor is offline  
Old 10-09-08, 03:52 PM   #63
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Post the attributes on the header you have an issue with.
haste is offline  
Old 10-09-08, 04:13 PM   #64
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 268
Haste, what did you mean exactly ?
First name what the original oUF_Experience was doing OnEnter/OnLeave so i can still have the tooltip displayed, then tell the layout to add a SetAlpha() to both. I'm not sure to get your point.

It works, just not on login, have to mouseover over the player frame just once then it start working.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Caellian is offline  
Old 10-09-08, 04:27 PM   #65
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 268
From my weird logical point of view it should be like this

Code:
			local origOnEnter = self.Experience:GetScript("OnEnter")
			self.Experience:SetScript('OnEnter', function(self,...) self:SetAlpha(1) origOnEnter(self, ...) end)

			local origOnLeave = self.Experience:GetScript("OnLeave")
			self.Experience:SetScript('OnLeave', function(self, ...) self:SetAlpha(0) origOnLeave(self,...) end)
But unfortunately that doesn't work, only the tooltip shows up.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Caellian is offline  
Old 10-09-08, 04:32 PM   #66
Alanor
A Murloc Raider
Join Date: Oct 2008
Posts: 8
Originally Posted by haste View Post
Post the attributes on the header you have an issue with.
The only attributes I set currently are:
*type2=menu
showSolo=true

showSolo I have it true to test the party frames without being in a party.

initial-width and initial-height are set to 200 and 30 respectively on the party members frames, e.g. oUF_PartyUnitButton1. I tried to set them on the header itself, but didn't make a difference, I could have done something stupid though.
Alanor is offline  
Old 10-09-08, 04:38 PM   #67
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Since oUF_Experience is pure smeg (in your face word filter!), you have to do the following:
Code:
			self:SetScript("OnEnter", function(self)
				local exp = self.Experience
				exp:SetAlpha(1)
				exp:GetScript"OnEnter"(exp)
			end)

			self:SetScript("OnLeave", function(self)
				local exp = self.Experience
				exp:SetAlpha(0)
				exp:GetScript"OnLeave"(exp)
			end)
This will execute the On* handler on self.Experience when you Enter/Leave your unit frame.

Originally Posted by Alanor View Post
The only attributes I set currently are:
*type2=menu
showSolo=true

showSolo I have it true to test the party frames without being in a party.

initial-width and initial-height are set to 200 and 30 respectively on the party members frames, e.g. oUF_PartyUnitButton1. I tried to set them on the header itself, but didn't make a difference, I could have done something stupid though.
So you don't have showParty set?
haste is offline  
Old 10-09-08, 04:47 PM   #68
Alanor
A Murloc Raider
Join Date: Oct 2008
Posts: 8
Originally Posted by haste View Post
So you don't have showParty set?
Nope, it looks strange to not have it set for a party header, but I've only been testing it while solo, and showSolo is enough for that. I'm planning to set it when I get a usable stable version though. :p
Alanor is offline  
Old 10-09-08, 04:48 PM   #69
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 268
Originally Posted by haste View Post
This will execute the On* handler on self.Experience when you Enter/Leave your unit frame.
But that's not the point, the point is to have the exp bar shown/hidden when i enter/leave the exp bar position
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Caellian is offline  
Old 10-09-08, 04:54 PM   #70
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Originally Posted by Alanor View Post
Nope, it looks strange to not have it set for a party header, but I've only been testing it while solo, and showSolo is enough for that. I'm planning to set it when I get a usable stable version though.
Then I have no idea why it isn't showing for you. Which means that the only option is to post code .

Originally Posted by Caellian View Post
But that's not the point, the point is to have the exp bar shown/hidden when i enter/leave the exp bar position
Then don't use self in your example code

Request it from p3lim as a feature, it's possible to do it, but the solution would be worse than what oUF_Experience already is.
haste is offline  
Old 10-09-08, 04:58 PM   #71
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 268
I will post a request in oUF_Experience topic. should have though of that earlier

But still this bother me, this code below works, perfectly. Isn't there a way to alter it to work even on login ?

The only moment it doesn't work is when i login, reload, maybe zone. i then have to mouseover my player frame, and then it works just fine.

Code:
			self:SetScript("OnEnter", function(self)
				local origOnEnter = self.Experience:GetScript("OnEnter")
				self.Experience:SetScript('OnEnter', function(self,...) self:SetAlpha(1) origOnEnter(self, ...) end)
			end)

			self:SetScript("OnLeave", function(self)
				local origOnLeave = self.Experience:GetScript("OnLeave")
				self.Experience:SetScript('OnLeave', function(self, ...) self:SetAlpha(0) origOnLeave(self,...) end)
			end)
Thanks for your help btw.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Caellian is offline  
Old 10-09-08, 05:00 PM   #72
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Due to how oUF_Experience works, no, not really. You're also hooking yourself over and over again in many cases with that code.
haste is offline  
Old 10-09-08, 05:57 PM   #73
Alanor
A Murloc Raider
Join Date: Oct 2008
Posts: 8
Originally Posted by haste View Post
Then I have no idea why it isn't showing for you. Which means that the only option is to post code :p.
I was afraid you're gonna say that. :p

It's a bit different from other oUF layouts, in that I'm trying to build an AceGUI-based configuration for the graphical part, just for setting the various options for elements (sizes, positions, fonts, textures, etc). I hope it's not (too much) against the oUF spirit, it's not supposed to be anything more than an graphical, no reload, way to play with the options already existing in oUF. I usually mess often enough with my unit frames to decide to go this way rather than a pure text file layout. It's heavily work in progress, the code is messy, I have little Lua experience, and I don't know if it's ever gonna be something usable, for now it's a fun thing to do. :p

If you still want to have a look: http://mist.tcc.googlepages.com/oUF_Mist.tar.gz, any comments/suggestions are appreciated!
Alanor is offline  
Old 10-09-08, 07:55 PM   #74
Kellen
A Deviate Faerie Dragon
Join Date: Mar 2008
Posts: 18
Event hooking

I'm look for the *correct* way to hook an oUF event, since I'm still rather new to all of this. Function hooking seems straight forward enough, but hooking events (without directly modifying oUF) is tripping me up. I've tried to start with simple, controlled events like PLAYER_UPDATE_RESTING.

Here's (roughly) what I've done:

Code:
local orig_PLAYER_UPDATE_RESTING = oUF.PLAYER_UPDATE_RESTING

local function iconHook(self, event)
  local hooks = {
    ["PLAYER_UPDATE_RESTING"] = orig_PLAYER_UPDATE_RESTING,
  }
  if hooks[event] then
    hooks[event](self, event)
    print('Hooked: '..event)
  end
end

-- Further down in setup code...
self.Resting = self.Health:CreateTexture(nil, 'OVERLAY')
...
self.PLAYER_UPDATE_RESTING = iconHook
This seems to intercept all events though, which is why I have the stupid lookup table in there. If I overwrite the other events I'm interested in and add them to the lookup, it seems to work (though, on player login the event doesn't fire). What is the proper way to intercept a single event? Or am I way off base here?
Kellen is offline  
Old 10-10-08, 01:59 AM   #75
WaldoJeffers
A Molten Giant
 
WaldoJeffers's Avatar
Join Date: Jan 2007
Posts: 564
How does one colour just their player frames HP bar white? http://pastey.net/97792
__________________
I said lady, step inside my Hyundai
WaldoJeffers is offline  
Old 10-10-08, 03:12 AM   #76
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 979
Originally Posted by Alanor View Post
I was afraid you're gonna say that.
<snip>
First of: it's not against the "spirit" of oUF. I don't do options in my layouts because I simply don't have the time to do all the work require.

Anyway, I've just quickly browsed through your code, and it seems you register unit watch on the header. Which causes the unit watch system to hide it as it doesn't have a existing unit. It's just a quick theory, but it would explain your debug stack
haste is offline  
Old 10-10-08, 03:58 AM   #77
Alanor
A Murloc Raider
Join Date: Oct 2008
Posts: 8
Originally Posted by haste View Post
Anyway, I've just quickly browsed through your code, and it seems you register unit watch on the header. Which causes the unit watch system to hide it as it doesn't have a existing unit. It's just a quick theory, but it would explain your debug stack
Great, thanks! That's an artifact of me mucking around with the layout since I didn't know if oUF:Spawn() calls the style function with the header or the children as parameter (I just barely start understanding secure headers). I'll change that tonight after work and see how it goes.
Alanor is offline  
Old 10-10-08, 08:26 AM   #78
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Caellian this code "should" work.


Code:
local hook = self.Experience.SetScript

function self.Experience:SetScript(handle, func)
	if handle ~= "OnEnter" and handle ~= "OnLeave" then return hook(self, handle, func) end
	return hook(self, handle, function(exp, ...) 
		exp:SetAlpha(handle == "OnEnter" and 1 or 0)
		func(exp, ...)
	end)
end
This will basically hook OnEnter and OnLeave whenever oUF_Experience changes the OnEnter and OnLeave.

Last edited by Slakah : 10-10-08 at 02:03 PM.
Slakah is offline  
Old 10-10-08, 08:27 AM   #79
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,174
Whats so wrong with oUF Experience?


Originally Posted by Qynova View Post
How does one colour just their player frames HP bar white? http://pastey.net/97792
Code:
if(UnitIsUnit("targettarget", "player")) then
  -- coloring
end
p3lim is offline  
Old 10-10-08, 02:00 PM   #80
Frayol
A Deviate Faerie Dragon
 
Frayol's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2008
Posts: 10
Originally Posted by p3lim View Post
Take a look at my raid layout (oUF Perfect), its based on pure tags for text
Thanks p3lim. It took me a while, but I finally got there.

I've now managed to show the AFK/DND states on my own oUF layout (a modified version of Lyn's layout). oUF Perfect was an immense help in starting to get my head around custom tags. I've also managed to replace the PvP icon (not by using custom tags mind... hmmm wonder if that might be an easier way to do it?) on both the player and the target frames, so all in all things are looking quite good for getting everything the way I want it.
Frayol is offline  
Closed Thread

Go BackWoWInterface » 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