Reply
Thread Tools Display Modes
Unread 11-17-12, 12:41 PM   #1
Jonisaurus
A Fallenroot Satyr
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 29
Custom Aura Addon Breaks in Combat

I wrote an addon that hides or shows specific Bartender buttons in relation to specific auras (anyone wondering: I basically use it as part of a WeakAuras aura setup).

Anyway, it works perfectly outside of combat, and it stops working in combat.

Code:
local frame = CreateFrame("frame")
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")


local function AuraEvent(self, event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
	local spellID, spellName, spellSchool = ...;
	
	-- These are the Aura functions that hide and show the Bartender buttons.

		if (message == "SPELL_AURA_APPLIED" or message == "SPELL_AURA_REFRESH") and sourceName == "Jyyn" then
			if  spellID == 100977 then
			BT4Button75:Show()
			elseif spellID == 16870 then
			BT4Button74:Show()
			elseif spellID == 126588 then
			BT4Button73:Show()
			elseif spellID == 117679 then
			BT4Button76:Show()
			elseif spellID == 124974 then
			BT4Button77:Show()
			end
		elseif (message == "SPELL_AURA_REMOVED") and sourceName == "Jyyn" then
			if  spellID == 100977 then
			BT4Button75:Hide()
			elseif spellID == 16870 then
			BT4Button74:Hide()
			elseif spellID == 126588 then
			BT4Button73:Hide()
			elseif spellID == 117679 then
			BT4Button76:Hide()
			elseif spellID == 124974 then
			BT4Button77:Hide()
			end
		end
	end
end

frame:SetScript("OnEvent", AuraEvent)
Halp!
Jonisaurus is offline   Reply With Quote
Unread 11-17-12, 01:05 PM   #2
Jonisaurus
A Fallenroot Satyr
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 29
I figured out what the problem is.

It's impossible to Show() or Hide() any of the Bartender buttons while in combat.
Is there any solution to this?



I wanted my Masque border texture around a WeakAuras aura, so coded my addon to show/hide the Bartender buttons so that they would only appear when the WeakAuras aura appeared.

Since the Bartender stuff can't be shown or hidden in combat, any solution to this?
Jonisaurus is offline   Reply With Quote
Unread 11-17-12, 01:30 PM   #3
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 80
All action buttons are secure frames, and secure frames can't be hidden/shown in combat (in order to prevent automated actions).

What you can do in combat is change the button visibility using SetAlpha, but keep in mind that in that case, the button will always be there even when fully transparent. So if the button can be clicked, it will always occupy that screen space with its clickable area.

If all you're after is the visual border or icon, you might need to look into other ways of showing the appropriate textures on screen in a way that doesn't tie it to a clickable secure frame.
Barjack is offline   Reply With Quote
Unread 11-17-12, 01:49 PM   #4
Jonisaurus
A Fallenroot Satyr
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 29
Ah thanks for the answer!

SetAlpha would be OK with me. Could you quickly show me how to do it?
Jonisaurus is offline   Reply With Quote
Unread 11-17-12, 04:18 PM   #5
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 80
Originally Posted by Jonisaurus View Post
Ah thanks for the answer!

SetAlpha would be OK with me. Could you quickly show me how to do it?
I'm unfamiliar with Bartender so I can't really give you code that I know works. But in your above example, if you were to replace, for example, BT4Button75:Show() with BT4Button75:SetAlpha(1), and BT4Button75:Hide() with BT4Button75:SetAlpha(0), that should give you an idea. Basically SetAlpha(0) will make something fully transparent in place of Hide(), and SetAlpha(1) will make something fully opaque in place of Show().

Of course, as I mentioned, using this method means the frames will technically always have to be shown and will probably always be clickable depending on how Bartender works, regardless of whether the buttons are transparent or not at any given moment.
Barjack is offline   Reply With Quote
Unread 11-17-12, 08:54 PM   #6
Jonisaurus
A Fallenroot Satyr
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 29
Thank you, I've achieved exactly what I wanted.

The Bartender bar is a pure cooldown display. I can select "Clickthrough" in the Bartender options and it's done. Thanks a lot!
Jonisaurus is offline   Reply With Quote
Unread 11-17-12, 08:55 PM   #7
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,391
Also note that if you have Bartender set to actually hide your bars under certain conditions, then the buttons on those bars will stay hidden no matter what you set their opacity to. You would need to use Bartender's "fade" feature instead of hiding the bars.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 11-17-12, 10:15 PM   #8
Jonisaurus
A Fallenroot Satyr
 
Jonisaurus's Avatar
Join Date: Aug 2011
Posts: 29
Originally Posted by Phanx View Post
Also note that if you have Bartender set to actually hide your bars under certain conditions, then the buttons on those bars will stay hidden no matter what you set their opacity to. You would need to use Bartender's "fade" feature instead of hiding the bars.
I circumvent that by not using any hide settings in Bartender itself but merely adjusting the Alpha of that Bartender bar in my own addon. That's how I have ultimate control over what shows where.

Maybe that's not the most elegant and efficient way, but it's what works best for me.

Transparent at player enter world, fully visible at player regen disabled, and then my own custom interaction with one button and WeakAuras.

Last edited by Jonisaurus : 11-17-12 at 10:17 PM.
Jonisaurus is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » Custom Aura Addon Breaks in Combat

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