WeakAuras

WeakAuras

206M Downloads

Error in SetVertexColor

fspano118 opened this issue ยท 2 comments

commented

Is there an existing issue for this?

  • I have searched the existing open and closed issues.

Description

While running a WA to show tick damage + color for skull of impending doom damage, I ran into the following error. WA is provided below in reproduction steps
The function used in the WA to set color

function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
    
    if(aura_env.dmg < 100) then
        return WeakAuras.GetHSVTransition(progress, r1, g1, b1, a1, r2, g2, b2, a2)
    end
    
    progress =  (aura_env.dmg - 100) / 400
    return WeakAuras.GetHSVTransition(progress, 0, 255, 0, 255, 255, 0, 0, 255)
end

The error I was getting was below, as well as the color not actually showing on the icon

Message: Lua error in aura 'Flee 2': Custom Color
WeakAuras Version: 5.11.3
Aura Version: 1.0.3
bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))
Time: Sat Mar  9 16:12:09 2024
Count: 905
Stack: Lua error in aura 'Flee 2': Custom Color
WeakAuras Version: 5.11.3
Aura Version: 1.0.3
bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))
[string "=[C]"]: in function `SetVertexColor'
[string "@Interface/AddOns/WeakAuras/RegionTypes/Icon.lua"]:439: in function <Interface/AddOns/WeakAuras/RegionTypes/Icon.lua:431>
[string "=[C]"]: in function `xpcall'
[string "@Interface/AddOns/WeakAuras/Animations.lua"]:126: in function <Interface/AddOns/WeakAuras/Animations.lua:17>

Locals: (*temporary) = "bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))"

I was able to fix the error and correctly display the colors by replacing the function ColorAnim in \Interface\AddOns\WeakAuras\RegionTypes\Icon.lua with

  function region:ColorAnim(r, g, b, anim_a)
    region.color_anim_r = r;
    region.color_anim_g = g;
    region.color_anim_b = b;
    region.color_anim_a = anim_a;
    if (r or g or b) then
      local a = anim_a or 1;
    end
    icon:SetVertexColor(r or region.color_r, g or region.color_g, b or region.color_b, a);
    if MSQ then
      region.button:SetAlpha(a);
    end`
  end

It fixed all errors, but and hasn't broken any of my other auras, but I haven't done any testing outside of that

WeakAuras Version

5.11.3

World of Warcraft Flavor

Classic

World of Warcraft Region

US/NA

Tested with only WeakAuras

  • Yes

Lua Error

Message: Lua error in aura 'Flee 2': Custom Color
WeakAuras Version: 5.11.3
Aura Version: 1.0.3
bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))
Time: Sat Mar  9 16:12:09 2024
Count: 905
Stack: Lua error in aura 'Flee 2': Custom Color
WeakAuras Version: 5.11.3
Aura Version: 1.0.3
bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))
[string "=[C]"]: in function `SetVertexColor'
[string "@Interface/AddOns/WeakAuras/RegionTypes/Icon.lua"]:439: in function <Interface/AddOns/WeakAuras/RegionTypes/Icon.lua:431>
[string "=[C]"]: in function `xpcall'
[string "@Interface/AddOns/WeakAuras/Animations.lua"]:126: in function <Interface/AddOns/WeakAuras/Animations.lua:17>

Locals: (*temporary) = "bad argument #5 to '?' (Usage: self:SetVertexColor(color [, a]))"

Reproduction Steps

import aura below + use skull of impending doom

Last Good Version

Som

Screenshots

No response

Export String

!WA:2!nF1tVnUXv8vRoST6qSxLuJe3CGqg11kq1w276uG2S1ROSKTcKLCPKS39K0qYHKtxksIzgAlVbzbwFAV0EWNlqb05EYh7T6pbeg9lqnqV1Mc4pb5nZijl5nzRttkqhiko)5nZ7nV3V3VzyQQz7N1oR9BkmKyfg0kmMAHtrh00XHH57U1)4VFprzOvmJh2VnEapc7ehyXjHbRKpJguioRGIPOU4GJw1UVR2NPTEXI514E4a54IcfZJPbA5Yj7bhylFNzQHMEjYacqpzKj80dw6Kcl8xhCokWYlKUFijGBwUsJ2vmU0km03o84GwhtIW9IM)gRStKnIJnJLV2iM6h9t948i2VAT1og5gUkjCTnl7e9SOg1Ix7XuKCdX(udghr5lBQwOCzYCMDyxvdpthsaH5LrhEXxozUO5NzB)eTIjZ37uoL46IPS3Bz6OQV5JggZWDr9dJd4ENAdtsOSSRBeG6Jzzo1gZ4DG10mYhDcMEQq6yODVZyryF)gGulQx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)MFsuwoCBYUmpeCpZNPUsAQZK9j(l3pZkA(PKOSq1FEQuPsFLQxSVJ8gR6L60Uz07l7efdNuaWsRdj2Cp9sqZRLda3fdBl781xQUT7ZhPXlKJ)7GZyioNK8GHQTS4IU6nA2OsYsuWUfYmukO0d85PbO5Fsu(l7U1x9kr5pKwz6oHb8O5RsjVu73gJSbpcsRD7r71z18LY(ooKAFiffD6HJQOmOJimIPV4M3tnt5(9IMDa61U6nB3U5ExorPYJgGHQxRrLzCTZQoHOTiVeNFKBySJp6JM45bzOGtSR1OkqENhM46Xz6(HiBh6lHuC4q77BYHSXa(cg9J95KmsecYhyw6zy5JySfs4z0fmiQkGwfvmvNRzs6hfs56IVnQ3qQeNiZF)IZjbkfd9S85qvlCf5jS9I(qIBqif3ms(nfYERqPHuwpZUCe4VYApuqejX6SmgJIwqj6dg)fnIq72eMqABVnIj2N)ON3yadvsp)ov1fiipJJfifM(ldd7NYKH7dqAJ1xT4QpAip0Ae((hv4FLJyBk(6bTnIYcB(YJ0aWOcuM4Ej1sFTYlxLcS9IDNzRYgvQ04ChrhadjapeSFboe3musGyPXExcgbmPr7YmNnbQN8GZTjmXjp1G58H3)9)SthVR6DX4AvSDXEzzMBU66RV6JYE0F7zF9
commented

Your code is wrong, the "progress" value passed to GetHSVTransition needs to be between 0 and 1, your code doesn't ensure that.

You also should have debugged this first by figuring out what your custom code returns, instead of wrongly editing WA sources.

commented

@InfusOnWoW Your response could be a bit more cordial - I didn't open a PR to edit the WA source. It was just something I quickly took a look at and wanted to bring to the contributors attention. The Weakaura in question has been widely used for years through multiple client versions and never broken, so it's not unreasonable to think something had changed further down the stack.