@name Ball Sorter
@inputs R G B Button Ranger
@outputs Hydraulic SR SG SB LG
interval(3000)

Red=380
Green=280
Blue=173

if(R==255&!G&!B) {Hydraulic=Red}
if(!R&G==255&!B) {Hydraulic=Green}
if(!R&!G&B==255) {Hydraulic=Blue}

if(Button){if(clk()){LG=255,
Spawn=randint(1,3)
if(Spawn==1) {SR=1}
if(Spawn==2) {SG=1}
if(Spawn==3) {SB=1}}} else {Spawn=0,LG=0}

if(Ranger>0) {SR=0,SG=0,SB=0}
