Thread Tools Display Modes
11-25-09, 12:53 AM   #1
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Runebar Question

Hey there :P I know I have become a bugger when it comes to asking questions, but I haven't actually seen this implemented yet, so I come to ask!

Question - Is it possible to add a function to make the runebar fade OOC and come into full alpha in combat? If so, how about would i do this? Thanks in advance and sorry to bug you!

(My server is down, so Im on another server playing around on a dk >.>)

-Ferous
  Reply With Quote
11-25-09, 01:04 AM   #2
zero-kill
A Firelord
 
zero-kill's Avatar
Join Date: Aug 2009
Posts: 497
Are you referring to the primary (default) bar? I know of several standalone addons that do this.
  Reply With Quote
11-25-09, 01:07 AM   #3
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Originally Posted by zero-kill View Post
Are you referring to the primary (default) bar? I know of several standalone addons that do this.
No, i mean adding this functionality to the runebar created in the oUF layout.
  Reply With Quote
11-25-09, 01:23 AM   #4
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Should not be hard at all. The only part I don't know myself is how they are named. I don't know oUF too well, so I might be going off on a wrong path, but this is the basics in normal code.

Outline:

OnEvent
PLAYER_REGEN_DISABLED
Frame:SetAlpha(incombatvalue);
PLAYER_REGEN_ENABLED
Frame:SetAlpha(oocvalue);
Very basic outline, but hopefully that helps you out. You just need to create an OnEvent with those two events. Make sure you register them and you should be set to go.

Hope this helps.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
11-25-09, 01:53 AM   #5
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Originally Posted by Cralor View Post
Should not be hard at all. The only part I don't know myself is how they are named. I don't know oUF too well, so I might be going off on a wrong path, but this is the basics in normal code.

Outline:

OnEvent
PLAYER_REGEN_DISABLED
Frame:SetAlpha(incombatvalue);
PLAYER_REGEN_ENABLED
Frame:SetAlpha(oocvalue);
Very basic outline, but hopefully that helps you out. You just need to create an OnEvent with those two events. Make sure you register them and you should be set to go.

Hope this helps.
Thank you Cralor However I am a nooob still so i only know basic stuff, I still dont know exactly how to build anything yet, Im more of an advanced modifier of lua, but not being able to build it by scratch yet :P I learn everyday though I assume if I continue to stare at it, I will learn it lol Thanks though, I will still continue to try to figure this out
  Reply With Quote
11-25-09, 12:00 PM   #6
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
I did not know how much experience you had, so I left it at that. I can make it more detailed and specific if you would like. But I think it is always best that you take a stab at it first. Find the name of the Runebar that oUF makes if you haven't already. Let me know where you are stuck on and I'd be happy to help.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
11-25-09, 03:07 PM   #7
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
An overly simple version for oUF would be:
Code:
self:RegisterEvent('PLAYER_REGEN_ENABLED', function(self) self.Runes:SetAlpha(0) end)
self:RegisterEvent('PLAYER_REGEN_DISABLED', function(self) self.Runes:SetAlpha(1) end)
I haven't tested this, but it should work. Just make sure you haven't already registered those events for something else. If you have, you'll just want to add the 'self.Runes:SetAlpha()' bit to the existing function. Add this somewhere near the end of your layout function and you should be fine.

Edit: For those who don't know, oUF overrides the default RegisterEvent to allow you to register an event and include a function call. This way you don't have a giant "OnEvent" with a bunch of "if ... else" statements. The above code just creates a simple function assigned to the event that changes the alpha just like Cralor suggested. Just remember that ...ENABLED is out of combat and ...DISABLED is in combat. You can change the 0 and 1 values to any decimal number between 0 and 1 to suit your taste.

Edit 2: Fixed the end parentheses. Too used to working in an editor

Last edited by wurmfood : 11-25-09 at 04:30 PM. Reason: Clarification
  Reply With Quote
11-25-09, 04:00 PM   #8
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Ah, okay. Well there ya go! Oh and don't forget the missing parentheses in that small script, wurmfood.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
12-13-09, 02:46 PM   #9
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Originally Posted by wurmfood View Post
An overly simple version for oUF would be:
Code:
self:RegisterEvent('PLAYER_REGEN_ENABLED', function(self) self.Runes:SetAlpha(0) end)
self:RegisterEvent('PLAYER_REGEN_DISABLED', function(self) self.Runes:SetAlpha(1) end)
I haven't tested this, but it should work. Just make sure you haven't already registered those events for something else. If you have, you'll just want to add the 'self.Runes:SetAlpha()' bit to the existing function. Add this somewhere near the end of your layout function and you should be fine.

Edit: For those who don't know, oUF overrides the default RegisterEvent to allow you to register an event and include a function call. This way you don't have a giant "OnEvent" with a bunch of "if ... else" statements. The above code just creates a simple function assigned to the event that changes the alpha just like Cralor suggested. Just remember that ...ENABLED is out of combat and ...DISABLED is in combat. You can change the 0 and 1 values to any decimal number between 0 and 1 to suit your taste.

Edit 2: Fixed the end parentheses. Too used to working in an editor
Okay I added this (noob still) and had this lua error (no error upon reload though), I get this lua error when I enter combat:

[12:44:54] Interface\AddOns\oUF_noVeL\noVeL Layout.lua:432: attempt to index field 'runes' (a nil value)
[C]: ?
Interface\AddOns\oUF_noVeL\noVeL Layout.lua:432: in function <Interface\AddOns\oUF_noVeL\noVeL Layout.lua:432>
(tail call): ?
Any thoughts? I know, Im sorry to revive this, but I had just gaven up back when I made this thread but was trying to come back to it lol Thanks and sorry for reviving thread
  Reply With Quote
12-14-09, 12:31 AM   #10
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Can you post about 5 lines before and after line 432?

If you can't see the line numbers, you might want to check out Notepad++, a great, free editor that can handle Lua and will show line numbers. It makes diagnosing these kinds of problems much easier.
  Reply With Quote
12-14-09, 04:25 AM   #11
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Originally Posted by wurmfood View Post
Can you post about 5 lines before and after line 432?

If you can't see the line numbers, you might want to check out Notepad++, a great, free editor that can handle Lua and will show line numbers. It makes diagnosing these kinds of problems much easier.
I use notepad ++

i wasn't sure where to put it, I put it in my functions and i got lua errors. I put it after my style layout and i got lua errors, so i put it in the beginning of my layout and i got no lua errors but got lua errors ony when i entered and left combat.

here it is: (VERY very beginning)

Code:
local func = function(self, unit)
self.menu = menu -- Enable the menus

--- runes ---



--- /runes ----

self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
    
self:RegisterForClicks"anyup"
self:SetAttribute("*type2", "menu")

-- moveable frames ---

self.MoveableFrames = false
Also here is a snippet of the whole layout (yes its ugly, i need to do an overhaul of the code)

http://snipt.org/qgmp
  Reply With Quote
12-14-09, 01:22 PM   #12
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
I'd suggest adding it right after you set "self.Runes = runes". If you're still getting an error, could you post what it is?
  Reply With Quote
12-14-09, 06:18 PM   #13
Ferous
Sheer Sense of Doom
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 863
Originally Posted by wurmfood View Post
I'd suggest adding it right after you set "self.Runes = runes". If you're still getting an error, could you post what it is?
I tried that before hand and it wasn't working but now its working.... I updated oUF to the latest version just now so maybe that was it? :O Thanks wurmfood And thank you Haste!

edit - It doesn't update though till i enter combat then they fade/dissapear though, no lua errors, but after i enter combat do they dissapear but not upon logging in or reloading (When I log in or reload interface runes are full opacity until entering combat then they go to the set opacity i want when i leave combat :O )

ooc - http://i48.tinypic.com/166iu6r.jpg

ic - http://i48.tinypic.com/286za8j.jpg

Last edited by Ferous : 12-14-09 at 06:29 PM.
  Reply With Quote
12-14-09, 10:08 PM   #14
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Add a similar one but for PLAYER_ENTERING_WORLD and that should do it.
  Reply With Quote
12-15-09, 01:11 AM   #15
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
It's better to add a function entry to __elementes, than registering a new PEW.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Runebar Question


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