#Configure texture of power bar conditionally based upon an aura.

1 messages · Page 1 of 1 (latest)

wispy yacht
#

Hi guys,

I've tried doing this via conditions (Doesn't have an option) and have also tried a custom trigger (with the help of chat gpt to fill in my syntax gaps), but I can't seem to correctly identify the background texture I want. The texture is changing, but the bar is either transparent or has an alpha value of 0, and i'm unsure how to test further. The code block i'm currently using is:


function(events, ...)
    local unit = "player"
    local auraID = 24858
    local texture = "Blizzard Lunar Power"
    local LSM = LibStub("LibSharedMedia-3.0")
    
    -- Check if the aura is active
    local function IsAuraActive(unit, auraID)
        for i = 1, 40 do
            local _, _, _, _, _, _, _, _, _, spellID = UnitBuff(unit, i)
            if spellID == auraID then
                print("Aura 24858 is active")
                return true
            end
        end
        print("Aura 24858 is not active")
        return false
    end
    
    -- Set the bar texture when the aura is active
    local function SetBarTexture()
        if IsAuraActive(unit, auraID) then
            print("Setting bar texture to Blizzard Lunar Power")
            aura_env.region.bar:SetStatusBarTexture(LSM:Fetch("progressbar", texture))
        else
            print("Resetting to default texture")
            aura_env.region.bar:SetStatusBarTexture(LSM:Fetch("progressbar", aura_env.region.bar.defaultTexture))
        end
    end
    
    -- Run the function to set the bar texture
    SetBarTexture()
    
    return false -- Returning false since this is a non-activation trigger
end

hidden vessel
#

changing the texture of a bar isn't currently supported, anything that you do would be getting into addon editing territory, and could cause unintended behaviors for your aura and it's likely to break with future updates.

#

also I wouldn't rely on chatGPT to give you a reasonable answer on this.

#

Your code above does a few things that are just wrong or very bad for performance

vocal matrix
#

For the detection of active aura, that has nothing to do in a custom check condition, use an aura trigger for that
For the change of texture, that sound like a reasonable feature request

#

!ticket

green sunBOT
wispy yacht
#

Thank you both for the help, done.