How do I fix e_stop and my code on vex natural language programming in robotc?

How do I fix e_stop and my code on vex natural language programming in robotc?



Sensor and Motor setup is: drivemotor in port2(VEX 393 Motor), turnmotor in port3(VEX 393 Motor), servo in port 4 (3-wire Servo) 
Sensors: 
rightline,midline,leftline (all line followers) 
Digital Sensors: 
bumpSwitch (touch), e_stop (touch) 
Bottom line is that I am wondeirng how to make an e_stop work in this code and what other problems I have with my brackets in the program because it reads executable statements not valid in main declaration block. The e_stop and very last bracket is marked witha red X. 
Here is all my code 
task main() 

task e_stop() 

while(true) 

if(SensorValue(e_stop)==1) 
stopAllTasks(); 
waitIMsec(30); 


startTask(e_stop); 
untilTouch(bumpswitch); 
startMotor(DriveMotor,-63); 

while(true) 
if(SensorValue(leftline)<1700) 

if(SensorValue(rightline) >= 1700) 
startMotor (TurnMotor, 63); 

else 

stopMotor (TurnMotor); 
if(SensorValue(rightline) >=2700) 
if(SensorValue(midline)>=2700) 
if(SensorValue(leftline) >=2700) 

stopMotor (DriveMotor); 
stopMotor (TurnMotor); 
startMotor(Servo,-127); 
wait(1); 
startMotor (Servo, 127); 
stopMotor(Servo); 


if(SensorValue(rightline)<1700) 

if(SensorValue(midline)<1700) 

if(SensorValue(leftline)<1700) 

wait1Msec(2000); 
motor[TurnMotor] = -127; 
motor[DriveMotor ]= 0; 
wait1Msec(750); 
motor[DriveMotor] = 127; 
motor[TurnMotor] = 0; 
wait1Msec(750); 




}

Update: How do I fix e_stop and my code on vex natural language programming in robotc? 
I am trying to make my robot follow a line then turn a 90 degree angle and stop at horizontal line and then drop off an object (this is servo motor function)

Update 2: My robot has two wheels at the front, with only one motor which is my drive motor. Then it has one wheel at the back end that serves as the turn motor.





No Answers Posted Yet.