Thread Tools Display Modes
07-20-11, 09:09 PM   #1
Archer50
An Aku'mai Servant
AddOn Compiler - Click to view compilations
Join Date: Oct 2008
Posts: 37
Making Bison Fade Out

Hello,
I would like Bison to fade out until moused over while out of combat, and have it show (with full opacity) while in combat.

I currently have this:
Code:
local frame = CreateFrame("Frame") --Create a frame to detect the events with

--Register the events we want to use
frame:RegisterEvent("PLAYER_REGEN_DISABLED") --Fired when you enter combat
frame:RegisterEvent("PLAYER_REGEN_ENABLED") --Fired when you leave combat

local function HideOrShow(self, event, ...) --Create a function to react to the events
	if event == "PLAYER_REGEN_DISABLED" then
		BuffFrame:Show() --Show the AddOn's frame when you enter combat
	
	elseif event == "PLAYER_REGEN_ENABLED" then
		BuffFrame:Hide() --Hide the AddOn's frame when you leave combat
	end
end

frame:SetScript("OnEvent",HideOrShow) --Tells the game to execute our function when our frame detects an event
It hides Bison buffs while out of combat, but as stated before I would like something similar to this, but faded out until moused over rather than completely hidden.
  Reply With Quote
07-21-11, 06:25 AM   #2
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
You could use the Alpha channel and create onenter/onleave functions for the frame.

eg
Code:
BuffFrame:SetScript("OnEnter",
	function(self, motion)
		self:SetAlpha(1)
	end)
BuffFrame:SetScript("OnLeave",
	function(self, motion)
		self:SetAlpha(0.5)
	end)
If you mouseover a Buff icon, you aren't mouseovering the BuffFrame anymore and the OnLeave function will be triggered.
So advanced checks are required (incombat, timer etc)

You could also use a hook for the buff's onenter/onleave function.
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 07-21-11 at 06:28 AM.
  Reply With Quote
07-21-11, 08:16 AM   #3
Archer50
An Aku'mai Servant
AddOn Compiler - Click to view compilations
Join Date: Oct 2008
Posts: 37
Thanks for the reply Humfras. Where in my code would I put this? Or would I just put this as a separate block of code? Sorry I'm not too proficient in this :3
  Reply With Quote
07-21-11, 08:42 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
You can put it anywhere really, it modifies the BuffFrame frame and makes it fade in/out when mouseover/out. For example you can put it on the bottom of you file.
  Reply With Quote
07-21-11, 08:59 AM   #5
Archer50
An Aku'mai Servant
AddOn Compiler - Click to view compilations
Join Date: Oct 2008
Posts: 37
Originally Posted by Vladinator View Post
You can put it anywhere really, it modifies the BuffFrame frame and makes it fade in/out when mouseover/out. For example you can put it on the bottom of you file.
It doesn't seem to work :3 Do I have to put something like
Code:
local frame = CreateFrame("Frame") --Create a frame to detect the events with
before it?
  Reply With Quote
07-22-11, 03:43 AM   #6
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
The SetScript command just needs to be ran once after the BuffFrame is created. (e.g. via PLAYER_ENTERING_WORLD event)

I will try to take a look at Bison if I have some time during the weekend.
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Making Bison Fade Out


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