View Single Post
12-19-20, 01:20 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
It's possible there's a problem with accessing global variables within the aura environment during loading screens. WeakAuras attempts to keep aura environments restricted. You can try collecting the color data in a custom init (initialize), storing it in aura_env, and then just using that.

To use the custom init in an aura, click the Actions tab, check Custom under On Init, then put the following in the box that shows up:

Lua Code:
  1. aura_env.colors = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[(select(2, UnitClass("player")))]

Now in your color function:

Lua Code:
  1. function()
  2.     return aura_env.colors.r, aura_env.colors.g, aura_env.colors.b, 1
  3. end

On Init happens once when the aura loads, which means it'll only load the colors on UI load and every time you close the WeakAuras window. Since the color data is now saved within the aura environment, it's always there for use by the aura.
  Reply With Quote