This what I had, when it didn’t work.
// rgb.txt
[IButton, "R G B error", "Get RGB value",
[VarDef, color, 0]
[Var, Red] // throws error
[Var, Green]
[Var, Blue]
[VarDef, RGBint, 0]
[VarDef, msg, ""]
// Int to RGB
[VarSet, msg, ""]
[VarSet, color,[IGet,Color:Main Color]*65536] // 16777215
[VarSet, Red,((color & 0xFF0000) >> 16)]
[VarSet, Green,((color & 0x00FF00) >> 8)]
[VarSet, Blue,(color & 0x0000FF)]
[VarSet, msg, [StrMerge, msg, color, " - RGB: ", Red, ", ", Green, ", ", Blue]]
[Note, msg, 2]
]/*End of ZScript*/
Which re-produces the error above,
but I was getting confused and had this code at one point:
[IButton, "R G B error", "Get RGB value",
[VarDef, colour, 0]
[VarDef, Red, 0]
//[Var, Green]
//[Var, Blue]
[VarDef, RGBint, 0]
[VarDef, msg, ""]
// Int to RGB
[VarSet, msg, ""]
[VarSet, colour,[IGet,Color:Main Color]*65536] // 16777215
[VarSet, Red,((color & 0xFF0000) >> 16)]
//[VarSet, Green,((color & 0x00FF00) >> 8)]
//[VarSet, Blue,(color & 0x0000FF)]
//[VarSet, msg, [StrMerge, msg, color, " - RGB: ", Red, ", ", Green, ", ", Blue]]
//[Note, msg, 2]
]/*End of ZScript*/