Skip to content
​Florian H edited this page Jan 28, 2023 · 12 revisions

aura_env

aura_env is a built-in local table at the top of each aura declaration. Variables declared in this table will have their scope limited to the containing aura. aura_env can be accessed as global variables by functions within the current aura while remaining invisible to other auras.

To use aura_env for your own variables, simply assign it as a prefix to your variable name. An example of its use would be:

--Custom Trigger Function
function()
    -- Select the icon for either Moonkin form or Bear form.   
    aura_env.icon = select(2, WA_GetUnitBuff("player", "Moonkin Form")) or select(2, WA_GetUnitBuff("player", "Bear form"))
    return aura_env.icon -- If an icon is present, this will return true.
end

-- Custom Icon Function
function()
    -- Return the Icon we found. (Moonkin, Bear, or None)
    return aura_env.icon
end

Within aura_env

aura_env currently has 5 values id, cloneId, region, state and states.

  • id simply outputs the name of the current aura.
  • cloneId is used with "Trigger State Updater" where it will return unique ID for each state.
  • region is the region of the aura. See here for more.
  • state is a table that stores information about the current state. The current state is the one that the aura is pulling dynamic information from. See below for more information.
  • states is a table that stores the state information of every trigger, similar to state. It is not accessible from trigger functions.
    • aura_env.states[2] would access the state of the second trigger.
  • saved is a storage auras can use to store data across sessions

Within aura_env.state and aura_env.states

The values contained within the state depend on the type of trigger being used. Some potentially useful ones are:

  • aura_env.state.show - a simple and quite useful boolean for whether the trigger is active or not
  • aura_env.state.stacks
  • aura_env.state.duration
  • aura_env.state.expirationTime
  • aura_env.state.icon
  • aura_env.state.spellId

All text replacements are valid state values, except the one-letter replacements. These can be found in the tooltip when mousing over the Display Text box in the Display tab, as seen here. %percenthealth would equate to aura_env.state.percenthealth, for example.

Be especially careful to catch nil values from these variables before using them in things like custom animation functions.