WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Custom Aura Addon Breaks in Combat (https://www.wowinterface.com/forums/showthread.php?t=45170)

Jonisaurus 11-17-12 12:41 PM

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 11-17-12 01:05 PM

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?

Barjack 11-17-12 01:30 PM

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.

Jonisaurus 11-17-12 01:49 PM

Ah thanks for the answer!

SetAlpha would be OK with me. Could you quickly show me how to do it?

Barjack 11-17-12 04:18 PM

Quote:

Originally Posted by Jonisaurus (Post 269034)
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.

Jonisaurus 11-17-12 08:54 PM

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!

Phanx 11-17-12 08:55 PM

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.

Jonisaurus 11-17-12 10:15 PM

Quote:

Originally Posted by Phanx (Post 269054)
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.


All times are GMT -6. The time now is 05:30 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI