You have a $2 in the $3 line.
My bad. Fixed.
I did thought about doing a while loop, but decided it was unnecessary, only because it's only repeated 3 times. :P
Yea just change unset %brgb.* to var %brgb.r,%brgb.g,%brgb.g
Or you could put the unset at the bottom instead.
I'd use unset at the bottom, but if you've ever made a custom identifier, the script halts after "return," and a timer would probably mess it up if the identifier is used again immediately after the first one.
Regardless, I'll change it to var anyways. Thanks for the tips.