@name Detector Score System
@inputs Crash1 Crash2 Bumper1 Bumper2 Ramp Ball
#I added this so you can reset with a button
@inputs Reset

@outputs Score Ball
@persist Score Ball
#if reset is 1 OR Ball is equal to or less than 0 do this
if (Reset | Ball<=0) {Score = 0 Ball = 4}

if (Crash1<50 & Crash1!=0) {Score+=100}
if (Crash1<50 & Crash1!=0) {Ball-=1}
if (Crash2<50 & Crash2!=0) {Score+=100}
if (Crash2<50 & Crash2!=0) {Ball-=1}
if (Bumper1<380 & Bumper1!=0) {Score+=50}
if (Bumper2<380 & Bumper1!=0) {Score+=50}
if (Ramp<50 & Ramp!=0) {Score+=400}

#Not needed as ball will be from 4 to 0 instead 0 to -infiniy
#you must reset ball as well or it will stay less than or equal to -4
#and keep getting lower and reset is not going to do anything cause
#there's no "if" that tells it what to do if Reset is 1 and reset 
#won't be zero ever after it's 1 cause there is no condition or else
#that resets it. 
#if (Ball>=-4) {Reset = 1}
