1. #1

    Weak Auras 2 show/hide aura with keybind (button toggle)

    Hi all, I´m new to MMO Champion, and it´s a incredible community. I have a problem, need to use a keybind to show/hide (button toggle) a specific aura. I know there is custom trigger and events involved in this task, but I´m a noob in lua programming. Anyone knows how to do this?

    Thanks!

  2. #2
    What, you want a region that's only triggered by your key press? Or you want the key press to override the triggers? Or you want the key press to switch the visibility until the next time the triggers fire?

  3. #3
    Quote Originally Posted by pnutbutter View Post
    What, you want a region that's only triggered by your key press? Or you want the key press to override the triggers? Or you want the key press to switch the visibility until the next time the triggers fire?
    I want the key press to switch the visibility until the next time the triggers fire. In other words, I want to press a key to turn on visibility on that aura, and press again the same key and turn it off. I want to show an aura under certain conditions, and one of these may be this custom trigger.

  4. #4
    I'm still a little confused. Here are different things you could do. I'll use an example where the other trigger is an Aura trigger.

    Key press always immediately switches current state:

    • Key press > Show
    • Aura gain > Show (already shown)
    • Aura fade > Hide
    • Key press > Show
    • Aura gain > Show (already shown)
    • Key press > Hide
    • Aura fade > Hide (already hidden)
    • Aura gain > Show
    • Aura fade > Hide
    • Key press > Show

    Key press toggles its own required trigger:
    • Key press > Enable (but not shown)
    • Aura gain > Show (enabled)
    • Aura fade > Hide
    • Key press > Disable & Hide (already hidden)
    • Aura gain > n/a (disabled)
    • Key press > Enable & Show
    • Key press > Disable & Hide
    • Aura fade > Hide (already hidden)
    • Aura gain > n/a (disabled)
    • Key press > Enable & Show
    • Aura fade > Hide

    Key press toggles its own optional trigger:
    • Key press > Show
    • Aura gain > Show (already shown)
    • Aura fade > n/a (key toggled on)
    • Key press > Hide
    • Key press > Show
    • Aura gain > Show (already shown)
    • Key press > n/a (aura present)
    • Aura fade > Hide
    • Aura gain > Show
    • Key press > Show (already shown)
    • Aura fade > n/a (key toggled on)
    • Key press > Hide

  5. #5
    The aura will be always on, the keypress will switch show/hide status. Imagine I have a macro with F2 keyind, that macro start a event, custom trigger detect it and show aura. I press F2 again and aura fade. I only want show a circle (aura) when I press F2, and hide it pressing F2 again. The other trigger can be stay alive, because I want it respond only to my F2 key while playing.

  6. #6
    So you want a region that's only triggered by your key press? It has no other triggers, the only thing that ever affects whether it is shown is your pressing the key. Correct?

  7. #7
    Exactly. Hit F2 key and circle show, 1 minute later hit F2 again, and circle hide.

  8. #8
    Quote Originally Posted by kspadan View Post
    Exactly. Hit F2 key and circle show, 1 minute later hit F2 again, and circle hide.
    Uh, you could do this with a custom Event-Status trigger. Set a binding, watch for the key event, and toggle on or off. It's possible, but I don't have the time to look into making it work right now.

  9. #9
    A trivial way to do it would be to set custom show/hide triggers. that just:
    Make that aura trigger on a custom event called something like "TOGGLE_SHOW_HIDE_AURA"
    Code:
    -- show:
    function()
      return SHOULDSHOW
    end
    
    -- hide:
    function()
      return not SHOULDSHOW
    end
    then just make a macro:
    Code:
    /run SHOULDSHOW = not SHOULDSHOW; WeakAuras.ScanEvent('TOGGLE_SHOW_HIDE_AURA')
    I haven't got a copy of warcraft handy, but that should do the job with the benefit that anything else the aura does (like send chat messages) are also paused because the aura isn't actually active unless SHOULDSHOW is true.
    A new UI series for 5.2Steal my old UILearn about WeakAuras • Nobody to raid with right now so no PVE videos.

  10. #10
    Here's one way to do it

    Weakaura
    Code:
    duZfdaGEOu6LqrSlOcVgvvZfQuZMIBtv2jsQ9sA3G2V0OefddQYVP0qHsQbRA4OkhekvNsu1XqILcv0IHQA5qwesYtv8yL65aMiuctLkMmQmDHlcLIRcLOltCDuomITIQYMPQSDG(iuunlrLPbfPVcvYdHcNxjA0IsNgPojvv)vjCnOOCpL0kPsldkjFwKvkQJoE6WPdN6Odss0wOZsEIo0Bluhgmq0PKGuhD2mGW6PJpgCh0wygbuGrUKzcuoqIHj5RBFFFVXUjM(nibTsfUec)egIaGbdiSEo2uYiuOQU99990(6tMjq9eixpiXWKEcKRpzMaTUUbjO(iRaRBFFFFFFFpscgc2hwiZdFbLbKyys(1v8QBFFFVa5QRa50qhiZZbrNsccqPMIobIoLeK6OtSKNOZMbewpDeqbga6GbFyhNlWsSglWUd2OZMbewpD8XG7G2cZiGcmYLmtGYbsmmjFD7777n2nX0VbjOvQWLq4NWqeamyaH1ZXMsgHcv1TVVVN2xFYmbQNa56bjgM0tGC9jZeO11nib1hzfyD77777777rsWqW(WczE4lOmGedtYVUsPU9999IbqO91dTrFYmbQNa56H2OhKyysFKvG1TVVVVVVVhNsIgieeg8rqz2Geuo8Yx3(((EbYvxbYPZMbewVfXsEIoabjya6SZkB(1rafyOHoewyv81HMthmrw6ytjJ4FBHu0HJgGNHS0)2c1XpmeKpYwWT)TfcGB)uZ3cmNgB9SlggpbneE8eegzjOKOJXs4uhDqwJOo64XmbT6OHg6WaKfqbuqk(AOHoa6Gv4apCGz6aQutbtPGNgQc
    Macro text
    Code:
    /run local cvar="WeakaurasCustomToggle1" SetCVar(cvar,1-GetCVar(cvar),cvar)
    Last edited by pnutbutter; 2014-03-12 at 11:14 PM.

  11. #11
    Thanks pnutbutter, in a first try your code work perfect. Tomorrow will check it extensively, and evn code too. Thanks bro!!!

  12. #12
    Need help . I have set a macro and two auras. When enter game appear aura 1 by default OFF, and when execute macro turn it ON. Press again macro and turn it OFF. Works perfect. Here is macro code:

    Code:
    /run toggle_single = not toggle_single
    Auras code:

    Aura 1: (shows OFF text), type: Custom, Event Type: Status, Check On: Every Frame, Custom Trigger:

    show:
    Code:
    function()
        if toggle_single == true then
            return true
        else
            return false
        end
    end
    hide:
    Code:
    function()
        if toggle_single == false then
            return true
        else
            return false
        end
    end


    Aura 2: (shows ON text), type: Custom, Event Type: Status, Check On: Every Frame, Custom Trigger:

    show:
    Code:
    function()
        if toggle_single == true then
            return false
        else
            return true
        end
    end
    hide:
    Code:
    function()
        if toggle_single == true then
            return true
        else
            return false
        end
    end

    This always works perfect. But I need a second set of ON/OFF auras. I just duplicate macro and the two auras, just changing variable name to toggle_aoe. This way when I enter game, this second OFF text appear right, but when push the macro (the second one), the ON text won´t appear. Press macro again and OFF aura appear. I don´t know why the ON aura won´t appear.

    Anyone know why this behaviour?

    Thanks

  13. #13
    probably forgot to replace the variable name in your "Aura 2" functions.

  14. #14
    In total there is 4 auras. Single - ON, Single - OFF, Multi - ON, Multi - OFF, and 2 macros, for switch single on off and multi on off.
    Single ON and OFF use toggle_single variable. Multi ON and OFF use toggle_aoe variable. It´s correct. But Aura 2 set (multi on - multi off) won´t work, only appear multi - off, and when press keybind with macro don´t show multi - on, show nothing, press again macro and show multi off. I don´t know where is the trouble.

  15. #15
    what happens when you press your toggle_single macro with all 4 auras enabled?

  16. #16
    Single OFF (by default appear OFF, which is good) if press single macro Single OFF hide and appear
    Single ON, if press single macro Single ON hide and appear
    Single OFF, if press single macro Single OFF hide and appear again Single ON (and so on)

    Multi OFF (by default appear OFF, which is good) if press aoe macro Multi OFF hide and
    ->Not appear Multi ON, if press aoe macro appear
    Multi OFF, if press aoe macro Multi OFF hide and
    ->Not appear Multi ON, (and so on)

    In total there is 4 auras, but only show 2 at once: Single OFF or Single ON and Multi OFF or Multi ON. Single and Multi are independent.
    Last edited by kspadan; 2014-03-17 at 06:24 PM.

  17. #17
    That's weird, maybe we're missing something. Can you convert your Multi ON to string and paste here?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •