Help with auto code

Hi
I have been having problems with my auto code i want 4 autos pretty much 2 for each side and i have a ultrasonic sensor to check which side is left and right and a pot to control which version of auto i want. i honestly have no clue what i am doing wrong so can u show me how to fix it so i can learn for next time.

I haven’t actually made the auto but i just don’t know how to fix the errors.


#pragma config(Sensor, in8,    autonc,         sensorPotentiometer)
#pragma config(Sensor, dgtl2,  ad,             sensorTouch)
#pragma config(Sensor, dgtl4,  autons,         sensorTouch)
#pragma config(Sensor, dgtl5,  ultra,          sensorSONAR_inch)
#pragma config(Sensor, dgtl10, claw,           sensorDigitalOut)
#pragma config(Sensor, dgtl11, au,             sensorTouch)
#pragma config(Sensor, dgtl12, solenoid,       sensorDigitalOut)
#pragma config(Motor,  port2,           a1,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port3,           a2,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           a3,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port5,           d2,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           d1,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port7,           a4,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           a5,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           a6,            tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"

void pre_auton() {

	// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
	// Autonomous and Tele-Op modes.



	bStopTasksBetweenModes = true;

}


task autonomous() {
	
if(SensorValue(autonc)<=500)
	{//fence stars
	{if(SensorValue(ultra)>=48)
		//do the fence stars on the right side

						}else{
						//do the fence stars on the right side
					}
						} else {
						//field stars
		{if(SensorValue(ultra)>=48)
			//do the field stars on the right side
					} else {
					//Do the field stars on the left side
				
}

}

}


task usercontrol() {

	while(true)
	{
		if(vexRT[Btn8L] == 1)
		{
SensorValue[solenoid] = 1;
}
	if(vexRT[Btn8L] == 0)
{
SensorValue[solenoid] = 0;
}
     if(vexRT[Btn6D]==0)
{
SensorValue[claw]=1;
}
   if(vexRT[Btn6D]==1)
{
SensorValue[claw]=0;
}


		// Set drive motors
		setMultipleMotors(vexRT[Ch2], d1);
		setMultipleMotors(vexRT[Ch3], d2);

		// Loop while robot's upper sensor is pressed in (add in pneumatic pistons when we get some)
		if(SensorValue(au)) {

			SensorValue[solenoid] = 1;

			// Stop all motors
			setMultipleMotors(0, a1, a2, a3, a4,);
			setMultipleMotors(0, a5, a6,);
			sleep(200);
				setMultipleMotors(-50, a1, a2, a3,);
				setMultipleMotors(-50, a4, a5, a6,);
				sleep(100);

			// If button 6U (upper right shoulder button) is pressed, active solenoid
			//SensorValue[solenoid] = vexRT[Btn8D];

		} else {

			// If B5U is pressed, motors gets set to full forward speed
			// If B5D is pressed, motors get set to full backward speed
			setMultipleMotors((vexRT[Btn5U] - vexRT[Btn5D]) * 100, a1, a2, a3, a4,);
      setMultipleMotors((vexRT[Btn5U] - vexRT[Btn5D]) * 100, a5, a6,);
      	//setMultipleMotors((vexRT[Btn7L] - vexRT[Btn7R]) * 127, a1, a2, a3, a4,);
      //setMultipleMotors((vexRT[Btn7L] - vexRT[Btn7R]) * 127, a5, a6,);
		}

		sleep(20);

	}


}

Isn’t your autonomous changer supposed to be in pre auton? Other than that, it looks pretty good!

Ya it is all in the right place i just cant figure out why i am getting ao many errors

wait i dont fully understand am i sopossed to put all of my code into pre auton?

No, only put code in pre-auton that you want to have run when you first turn on the robot before the match starts. Here is a cleaned up version of your code, I think your only issue is misplaced braces, have a look at this, notice how I have changed the formatting to help show where the various conditional statement start and stop.

#pragma config(Sensor, in8,    autonc,         sensorPotentiometer)
#pragma config(Sensor, dgtl2,  ad,             sensorTouch)
#pragma config(Sensor, dgtl4,  autons,         sensorTouch)
#pragma config(Sensor, dgtl5,  ultra,          sensorSONAR_inch)
#pragma config(Sensor, dgtl10, claw,           sensorDigitalOut)
#pragma config(Sensor, dgtl11, au,             sensorTouch)
#pragma config(Sensor, dgtl12, solenoid,       sensorDigitalOut)
#pragma config(Motor,  port2,           a1,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port3,           a2,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           a3,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port5,           d2,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           d1,            tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port7,           a4,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           a5,            tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           a6,            tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"

void pre_auton() {

  // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
  // Autonomous and Tele-Op modes.



  bStopTasksBetweenModes = true;
}


task autonomous() {

  if(SensorValue autonc ]<=500 ) {
    //fence stars
    if(SensorValue ultra ] >=48 ) {
      //do the fence stars on the right side
    }
    else {
      //do the fence stars on the right side
    }
  }
  else {
    //field stars
    if(SensorValue ultra ] >=48 ) {
      //do the field stars on the right side
    }
    else {
      //Do the field stars on the left side
    }
  }
}


task usercontrol() {

  while(true)
  {
    if(vexRT[Btn8L] == 1)
    {
      SensorValue[solenoid] = 1;
    }

    if(vexRT[Btn8L] == 0)
    {
      SensorValue[solenoid] = 0;
    }

    if(vexRT[Btn6D]==0)
    {
      SensorValue[claw]=1;
    }

    if(vexRT[Btn6D]==1)
    {
      SensorValue[claw]=0;
    }


    // Set drive motors
    setMultipleMotors(vexRT[Ch2], d1);
    setMultipleMotors(vexRT[Ch3], d2);

    // Loop while robot's upper sensor is pressed in (add in pneumatic pistons when we get some)
    if(SensorValue(au)) {

      SensorValue[solenoid] = 1;

      // Stop all motors
      setMultipleMotors(0, a1, a2, a3, a4,);
      setMultipleMotors(0, a5, a6,);
      sleep(200);
      setMultipleMotors(-50, a1, a2, a3,);
      setMultipleMotors(-50, a4, a5, a6,);
      sleep(100);

      // If button 6U (upper right shoulder button) is pressed, active solenoid
      //SensorValue[solenoid] = vexRT[Btn8D];

      }
    else {

      // If B5U is pressed, motors gets set to full forward speed
      // If B5D is pressed, motors get set to full backward speed
      setMultipleMotors((vexRT[Btn5U] - vexRT[Btn5D]) * 100, a1, a2, a3, a4,);
      setMultipleMotors((vexRT[Btn5U] - vexRT[Btn5D]) * 100, a5, a6,);
      //setMultipleMotors((vexRT[Btn7L] - vexRT[Btn7R]) * 127, a1, a2, a3, a4,);
      //setMultipleMotors((vexRT[Btn7L] - vexRT[Btn7R]) * 127, a5, a6,);
    }

    sleep(20);
  }
}

awesome, no more errors i will test tomorow morning to see if it works thank you very much!

@Cody

Looks like James beat me to this one, hopefully his answer helps. Feel free to bug me again if you run into more issues.

Ok thanks.