Try this...
Declare/initialize these variables at the top of Default_Routine
Code:
static unsigned char shooting = 0;
static unsigned char counter1 = 0;
And add the following anywhere in the body of Default_Routine
Code:
if (p1_sw_trig) shooting = 1;
if (shooting)
{
switch (counter1)
{
case 0: //TOP RAM OUT
relay4_fwd = 0;
relay4_rev = 1;
break;
case 20: //BOTTOM RAM IN
relay3_fwd = 1;
relay3_rev = 0;
break;
case 40: //BOTTOM RAM OUT
relay3_fwd = 0;
relay3_rev = 1;
break;
case 60: //TOP RAM IN
relay4_fwd = 1;
relay4_rev = 0;
shooting = 0;
counter1 = 0;
break;
default:
counter1++;
}
}