So, I’ve been trying to learn more derma and wanted to add a color panel but couldn’t find anything useful on either of the wikis or any nice examples to view.
CreateClientConVar([[carcolr]],math.random(0,255))CreateClientConVar([[carcolg]],math.random(0,255))CreateClientConVar([[carcolb]],math.random(0,255))CreateClientConVar([[carcola]],255)local carcol = vgui.Create(“CtrlColor”)carcol:SetConVarR(“carcolr”)carcol:SetConVarG(“carcolg”)carcol:SetConVarB(“carcolb”)carcol:SetConVarA(“carcola”)panellist:AddItem(carcol)
Seems to work fine, however I get spammed with this everytime I change the color via the CtrColor panel.
[ERROR] lua/includes/util.lua:33: bad argument #1 to 'min' (number expected, got nil) 1. min - [C]:-1 2. Color - lua/includes/util.lua:33 3. ConVarThink - lua/vgui/dcolormixer.lua:424 4. unknown - lua/vgui/dcolormixer.lua:401
The convars still update and I’m not sure why it’s erroring, from what I can tell it’s saying the color is nil but from what I can see it’s not. Also let me know if I’m doing this wrong, I’d rather not use a convar but it’s the only method I can find.
I’ve changed to using the “DColorMixer” after I realised I could find a working example in the Player Model code, much simpler and works fine now.
Mark as solved if anyone wants to / not sure if I can do it myself.