LCD Code Chooser

So I just did a code chooser (thank you sample programs), but it seems that in order for it to actually run, you have to press the button while in autonomous, which is not allowed. I am only using the built-in competition switch for robotC and my cortex with an LCD at the moment, as the robot is at my school, but this will be an issue in competition. This is my code;

void pre_auton()
{
	// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
	// Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
	bStopTasksBetweenModes = true;
	//---Reset Encoder Values
	nMotorEncoder[backLeft] = 0;				
	nMotorEncoder[backRight] = 0;

	//---LCD Code Selector---
	while(bIfiRobotDisabled == true)						//While the robot is disabled
	{
		//------------- Beginning of User Interface Code ---------------
		//Clear LCD
		clearLCDLine(0);
		clearLCDLine(1);
		//Loop while center button is not pressed
		while(nLCDButtons != centerButton)
		{
			//Switch case that allows the user to choose from 4 different options
			switch(count){
			case 0:
				//Display first choice
				displayLCDCenteredString(0, "RIGHT CUBE");
				displayLCDCenteredString(1, "<		 ENTER		>");
				waitForPress();
				//Increment or decrement "count" based on button press
				if(nLCDButtons == leftButton)
				{
					waitForRelease();
					count = 3;
				}
				else if(nLCDButtons == rightButton)
				{
					waitForRelease();
					count++;
				}
				break;
			case 1:
				//Display second choice
				displayLCDCenteredString(0, "LEFT CUBE");
				displayLCDCenteredString(1, "<		 ENTER		>");
				waitForPress();
				//Increment or decrement "count" based on button press
				if(nLCDButtons == leftButton)
				{
					waitForRelease();
					count--;
				}
				else if(nLCDButtons == rightButton)
				{
					waitForRelease();
					count++;
				}
				break;
			case 2:
				//Display third choice
				displayLCDCenteredString(0, "LEFT FENCE");
				displayLCDCenteredString(1, "<		 ENTER		>");
				waitForPress();
				//Increment or decrement "count" based on button press
				if(nLCDButtons == leftButton)
				{
					waitForRelease();
					count--;
				}
				else if(nLCDButtons == rightButton)
				{
					waitForRelease();
					count++;
				}
				break;
			case 3:
				//Display fourth choice
				displayLCDCenteredString(0, "RIGHT FENCE");
				displayLCDCenteredString(1, "<		 Enter		>");
				waitForPress();
				//Increment or decrement "count" based on button press
				if(nLCDButtons == leftButton)
				{
					waitForRelease();
					count--;
				}
				else if(nLCDButtons == rightButton)
				{
					waitForRelease();
					count = 0;
				}
				break;
			default:
				count = 0;
				break;
			}
		}
		//------------- End of User Interface Code ---------------------
	}
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{

	//------------- Beginning of Autonomous Code ---------------
	//Clear LCD
	clearLCDLine(0);
	clearLCDLine(1);
	//Switch Case that actually runs the user choice
	switch(count){
	case 0:
		//If count = 0, run the code correspoinding with choice 1
		displayLCDCenteredString(0, "RIGHT CUBE");
		displayLCDCenteredString(1, "3116C");

		rightCube();
		break;
	case 1:
		//If count = 1, run the code correspoinding with choice 2
		displayLCDCenteredString(0, "LEFT CUBE");
		displayLCDCenteredString(1, "3116C");

		leftCube();
		break;
	case 2:
		//If count = 2, run the code correspoinding with choice 3
		displayLCDCenteredString(0, "LEFT FENCE");
		displayLCDCenteredString(1, "3116C");

		leftFence();
		break;
	case 3:
		//If count = 3, run the code correspoinding with choice 4
		displayLCDCenteredString(0, "RIGHT FENCE");
		displayLCDCenteredString(1, "3116C");

		rightFence();
		break;
	default:
		displayLCDCenteredString(0, "No valid choice");
		displayLCDCenteredString(1, "was made!");
		break;
	}
	//------------- End of Autonomous Code -----------------------

	AutonomousCodePlaceholderForTesting();  // Remove this function call once you have "real" code.
}

We have a competition on Saturday so we need this to be done

Here is some basic form for the code chooser. If you have any questions just ask. Hope this helps.

#pragma config(Motor,  port2,           driveL,        tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           driveR,        tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(15)
#pragma userControlDuration(105)

#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!

const short leftButton = 1;
const short centerButton = 2;
const short rightButton = 4;

static int count = 0; // declare count variable to keep track of our choice

//Wait for Press
void waitForPress()
{
	while(nLCDButtons == 0){}
	wait1Msec(5);
}

//Wait for Release
void waitForRelease()
{
	while(nLCDButtons != 0){}
	wait1Msec(5);
}

void WaitForPressAndRelease (int value = -1) {
	waitForPress();
	if(nLCDButtons == leftButton) {
		waitForRelease();
		if (value > 0) {
			count = value;
		}
		else {
			count--;
		}
	}
	else if(nLCDButtons == rightButton) {
		waitForRelease();
		if (value == 0) {
			count = 0;
		}
		else {
			count++;
		}
	}
}

//////////////////////////////
// Pre-Autonomous Functions //
//////////////////////////////

void pre_auton()
{
	bStopTasksBetweenModes = true;

	SensorType[in8] = sensorNone;
	wait10Msec(100);
	SensorType[in8] = sensorGyro;
	wait10Msec(100);

	bLCDBacklight = true; // Turn on LCD Backlight

	// check if the robot is disabled or enabled
	if (nVexRCReceiveState & vrDisabled) {
		// Disabled
	}
	else {
		// Enabled
		return; // skip LCD selection
	}

	// Display the battery level
	string batteryString;
	sprintf(batteryString, "M: %1.2f B: %1.2f", (float)nImmediateBatteryLevel/1000.0, (float)BackupBatteryLevel/1000.0);
	displayLCDCenteredString(0, batteryString);

	// Code Chooser
	while(nLCDButtons != centerButton) {
		switch(count){

		case 0:
			displayLCDCenteredString(1, "<   No Auto.   >");
			WaitForPressAndRelease(6); // go forward to 4 if left is pressed
			break;

		case 1:
			displayLCDCenteredString(1, "<  Right Stars >");
			WaitForPressAndRelease();
			break;

		case 2:
			displayLCDCenteredString(1, "<  Left Stars  >");
			WaitForPressAndRelease();
			break;

		case 3:
			displayLCDCenteredString(1, "< Cube+Stars R.>");
			WaitForPressAndRelease();
			break;

		case 4:
			displayLCDCenteredString(1, "< Cube+Stars L.>");
			WaitForPressAndRelease();
			break;

		case 5:
			displayLCDCenteredString(1, "< Pro. Skills  >");
			WaitForPressAndRelease();
			break;

		case 6:
			displayLCDCenteredString(1, "<     Test     >");
			WaitForPressAndRelease(0); // go back to zero if right is pressed
			break;
		}
	}
}

//////////////////////
// Autonomous Tasks //
//////////////////////

void justStarsAuto (bool isRight = true)
{
	
}

void cubeAndStarsAuto (bool isRight = true)
{
	
}

void programmingSkills ()
{

}

void Test ()
{

}
//////////////////
//	LCD chooser //
//////////////////

task autonomous()
{
	//SensorValue[clawEncoder] = 0;
	bLCDBacklight = true; // Turn on LCD Backlight
	displayLCDCenteredString(0, "Autonomous");
	switch(count){
	case 0:
		// No Autonomous
		displayLCDCenteredString(1, "No Autonomous");
		break;
	case 1:
		displayLCDCenteredString(1, "Right Stars");
		justStarsAuto(true);
		break;
	case 2:
		displayLCDCenteredString(1, "Left Stars");
		justStarsAuto(false);
		break;
	case 3:
		displayLCDCenteredString(1, "Cube + Stars R.");
		cubeAndStarsAuto(true);
		break;
	case 4:
		displayLCDCenteredString(1, "Cube + Stars L.");
		cubeAndStarsAuto(false);
		break;
	case 5:
		displayLCDCenteredString(1, "Pro. Skills");
		programmingSkills();
		break;
	case 6:
		// test
		displayLCDCenteredString(1, "Test");
		Test();
		break;
	}
}

/////////////////////////
// Driver Control Task //
/////////////////////////

task usercontrol()
{
	bLCDBacklight = true; // turn on LCD backlight

	startTask(pidControllerCLAW);

	while (true) // driver control loop
	{

	}
}

And this won’t require for the center button to be pressed during the autonomous period for the code to run?

That’s the issue with my current code

No this won’t, I took this code strait out of my current robot’s program.

Thanks a lot! Used it at the last competition, works perfectly!