Custom Triggers

Custom Triggers

Custom triggers are an advanced feature that is only intended for users who know Lua. As such, the following page will assume you are familiar with Lua and related programming concepts. For more information on Lua, see Programming In Lua.

Custom triggers are a way for you to trigger a WeakAuras display using any arbitrary Lua code. There are two types of custom triggers; "Status" and "Event".


Status type custom triggers are based on the assumption that they will be used to check a value that can always be determined. Status type custom triggers can be set to be checked on certain events, or simply every frame. Either way, the main ways they differ from Event type custom triggers is that they do not receive event arguments, and they will be "forced" to update at certain times even when their specified events do not occur - e.g., when you close the WeakAuras configuration window.


Event type custom triggers are based on the assumption that they will be used with events that pass relevant information. As such, the main way in which they differ from Status type custom triggers is that event arguments are passed to them. This means that they will not be forced to update at time when Status type custom triggers would. Event type custom triggers can be set to hide on a timer, or they can have a custom untrigger.

Trigger Options

Check On...

Only available for Status type custom triggers. When set to "Every Frame", the trigger will not require any events, but will instead be checked using an OnUpdate script.


A list of events which will cause the custom trigger function to be called (as well as the untrigger function, if the trigger function returns false). Multiple events can be separated by whitespace and/or commas.

Custom Trigger

The custom trigger field should be an anonymous function which returns true if the trigger should become active. If the custom trigger is Status type, the function will not be passed any arguments. If the custom trigger is an Event types, the function will be passed all the arguments that are specified for the event that triggered, starting with the name of the event. If the function returns false, nil, or nothing, the trigger will not automatically become inactive - instead, failure of the trigger function will cause the untrigger function to be called.

Custom Untrigger

The custom untrigger field, just like the cusom trigger field, should be an anonymouse function, and it will be passed the same arguments as the trigger function. However, it should return true if the trigger should become inactive - i.e., the trigger's display should be hidden. If the untrigger function returns false, nil, or nothing, no change will be made to the display. It will remain visible if it is already visible, or it will remain invisible if it is already invisible. Most of the time, for Status type custom triggers, the untrigger function should be the exact opposite of the trigger function. However, it can be useful to define a trigger and untrigger in such a way that there is "grey area". See Trigger and Untriggers for more info.


Only available for Event type custom triggers. If set to "Timed", the Custom Untrigger field will be hidden, and the custom trigger will simply last for a pre-defined amount of time. If set to "Custom", a Custom Untrigger function can be defined.

Dynamic Information

Currently, custom triggers cannot pass Dynamic Information (Duration Info, Icon Info, Name Info, and Stack Info) to displays. This will be implemented in a later version.

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of Beutju Beutju Aug 05, 2011 at 01:12 UTC - 0 likes

    A function for a custom trigger can look like this:

    function() if UnitLevel("target")>83 then return true; else return false; end end

    If needed you should also add an untrigger function like this:

    function() if UnitLevel("target")<83 then return true; else return false; end end

    WeakAuras will pass the arguments from the event to the function. The first argument however will be the event name itself. The following example should trigger when someone in the raid dies:

    function(_,_,type,_,_,_,_,_,_,name, ...)
        if type == "UNIT_DIED" then
            for i=1,GetNumGroupMembers() do
                if UnitName("raid"..i) == name then
                    return true;
            return false;

    When the function() will return true; this means the trigger will do what you specified in WA. If it returns false; nothing will happen.

    Last edited Sep 05, 2012 by Beutju: another example
  • 1 comment