#Getting an error on the below code - UnitDebuff seems to be defunct

15 messages · Page 1 of 1 (latest)

ripe merlin
#
    local debuffIDs = {1822, 155722}
    local targetHasDebuff = false
    
    -- Check if the target exists
    if UnitExists("target") then
        -- Iterate over each debuff ID
        for _, debuffID in ipairs(debuffIDs) do
            local index = 1
            -- Iterate over each debuff on the target
            while true do
                local name, _, _, _, _, _, _, _, _, spellID = UnitDebuff("target", index)
                if not name then break end
                -- If the target has any of the specified debuffs, set targetHasDebuff to true
                if spellID == debuffID then
                    targetHasDebuff = true
                    break
                end
                index = index + 1
            end
            -- If the target has any of the specified debuffs, break out of the loop
            if targetHasDebuff then break end
        end
    end
    
    -- If targetHasDebuff is false, trigger the event
    if not targetHasDebuff then
        return true
    end
    
    return false
end```
drowsy bloom
#

why is that code?

#

you can accomplish that without any code

ripe merlin
#

well now I feel dumb. When I wrote this a while ago I couldn't work out how

drowsy bloom
#

you want to know when the enym as a debuff?

#

you can just list two debuffs in the buff trigger.

ripe merlin
#

aaah okay let me try that

#

ah.

#

Because i'm conditionally colouring the text based on the FeralSnapshots api

drowsy bloom
#

but that has nothing to do with the code here.

ripe merlin
#

no, this is the untrigger event for the custom trigger

#

which is triggering to mark that the text colour needs changing

drowsy bloom
#

nothing like that is happening there. thats just a bad copy of a default trigger.

ripe merlin
#

yes, i'm aware nothing like that is happening there

#

I have ``` function()
return FeralSnapshots.RelativeRake(UnitGUID("target")).total * 100