Need some help with code/weakaura

local adjustCastbars = function()
    for i, castbar in pairs(NN_ARENABARS) do
        castbar:SetScale(aura_env.config.scale)
        castbar:SetPoint("TOPRIGHT", aura_env.region, "TOPLEFT",0,-(i-1)*aura_env.config.gap)
    end
end

I wanted to add a custom option like

castbar:SetColorTexture( r, g, b, a)

but Im not sure if I also need to add (aura_env.config.color) somewhere. I guess I do but now sure where exactly.
color is the option key I put into my custom options. I have created a color picker there.

entire code looks like this:

local refreshMembers = function()
    for index, castbar in pairs(NN_ARENABARS) do
        castbar:SetUnit("arena"..index)        
    end
end

local createCastbars = function()
    NN_ARENABARS = {}
    for i=1,5 do
        local castbar = CreateFrame("StatusBar", "CustomArena"..i.."SpellBar", UIParent, "ArenaUnitFrameCastingBarTemplate");        
        castbar:SetUnit("player")   
        tinsert(NN_ARENABARS, castbar)
    end    
end

if not NN_ARENA_CASTBARS_CREATED then    
    hooksecurefunc(CompactArenaFrame, "RefreshMembers", function(self)
            refreshMembers()
    end)
    createCastbars()
    refreshMembers()
    NN_ARENA_CASTBARS_CREATED = true
end

--adjust scale and position from custom options
adjustCastbars()

I tried a few different approaches. But I dont even know if the SetColorTexture is correct. I tried removing custom options and replace rgb with numbers. Didnt work either. If i could put a color code in here somewhere I wouldnt need a color picker although I would prefer one.

Also im not sure how to link it here to show code colors. This code works 100% for me without any bugs. It has custom option for scaling and spacing. It cant be that hard to add coloring too. Any help is greatly appreciated. Cheers

Could dump the color and see how it’s being returned from the custom var then you’ll know how/if it needs to be manipulated.

DevTools_Dump(aura_env.config.color)

It returned 1 for 1-4. I deleted my lines (which caused errors anyways) and put in your line at the end that was the return

What do i do with this information? Ill attach a screenshot

Looks like the rgba values
So…

local r,g,b,a = aura_env.config.color
castbar:SetColorTexture( r, g, b, a)

Where would I put that in the code? If I set rgba values I dont need a color picker anymore or the color picker wouldnt even work I assume so.

is the aura_env.config.color there for the custom option? My option key is color or is it just how these color functions look like?

Wherever I put this code it causes lua errors. Should I put it “on show” instead of “on init”. Do I need an “end” in there somewhere?

Sorry, im a noob when it comes to this. Im just trying to learn and fix my aura

I assume it belongs in the first loop you posted, though you could do the variable assignments outside of it.

If you export the whole WA it’ll be easier for people to take a look at it.

https://wago.io/ZyKB287Pk

this is the entire aura. Once imported it shows just an icon. To see bars you would need to join arena

Try this

!WA:2!DA1tVTXXvCjZu0aM(hz1kJeKGITeTbKgY0IS1ofUqiGlnvKuKPyxsz5MI0vZU7SChRDNzWmZkr6IEO6qra6POdTxl05wua9rq3YTjc5dqQ(iyGEVVzwskjxPlDbK4SV593FZV3B25xBXSfJwm6lQFcjKr7ZYfH4pyUGdrdzB80J)SXFQBZF1h1BFXOTJJLy138doff9YCPch9mc9oIXfI)pNIOHjmrpgHQcA3P7GoENhYyPrSdP9pKWX7D20x7eneNiqHkcJkFSNuHeQYbXekrMu2f(r9HbHqeyzJERTtzHOuhbowGLjpdNfGfsNvDIZPw7RwRSd8eZeoeAeE0YoHiPkazE1HJicz1UD9B51PBl3wE9R5eXSgyEMO5t6Jv7abTAfKatrvQx36PAtvZQpMgv28x5I8juGrkC7chCd5ZvJjS7F4pEzwUAJLF0vZIjoCswVQtBRRxtGYWvR0xHu5sxKOYYovABXKwttY61R0NJttl2DNn6zsFfONvdtfzDIjjj0HGwdWz8uW3vQ9RVwTDJybO5ySOsTRQe4hjwOUgIodWRnfNS(1IvtrRccZTJwtGawkZaaOCbYhtpOoqhJjdRBLFj(9)5jCFie4QVPVLgP1Uj9Te5QvgSDpVn(K1hai8mBf4HqUdanS5wDwd2BLLFqvYdAu7(VP)hI4)pEVUlkC)HcwonYeO2MYBaEKkxGRAR1FxJpF5IfnNU4xmDXV8ZRDD(ij2HYuZiC(TB1FGbh8B71P1Gop1rLGPZoQtyS9L4qiuMJGQTzzCOp0sySKfOO8UwRgu3ZoSK404lRgZZ1BlRol1kwC9MKj7EJMC7z)QokroUOuFWdkiso2tnheq14mjXKBoXcwMtXqdhg3ozP81PDqOGNJJy(fQT3rkbz4qij6(HIjl)ZEuae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VDHfCMBU5w)J)67E3If)7V8l)7WIscc1Kj4Kl)Yw0O70mxKYF)eLIlFYdFO5ZHRtypC23d)WgMH1Mj4BaX7DVZ78VoAArNO)S9wug8O6n(O6RS4bFZl(V

Hi elvenbane!

thank you very much for this. I tested it and it changes the color. But this affects only the background of the progress bar.

I did use /fstack for my player cast bar (doesnt matter I assume because its the same textures for target/player/party etc.). The default cast bar consists of many layers.

I will try to add an additional line instead that replaces background with Border and see how it goes.

castbar.Background:SetColorTexture(color[1],color[2],color[3],color[4])

But you already helped me a lot, thank you again and I will report back after testing it further

Hi again

the coloring works but it also removes the texture from the background. Im looking for a way to darken/color the frame while keeping its textures.

This is what happens when I use Border instead of Background. Any idea what causes this?

Ok elvenbane, i got it to work by putting

castbar.Background:SetVertexColor(0.4, 0.4, 0.4, 1)

I also removed the custom color option and will change colors from now on directly in the code.

Thanks for leading me to the right track by putting Background in that line. I was using castbar:Set… before.

Thanks for helping, youve helped me before with other things which you probably dont remember but I appreciate it a lot that youre hanging out here and helping the community

1 Like

Glad you got it figured out and thanks for the kind words.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.