Main Scope Level

Error:Functions must be defined at main scope level, this shows in my compiler, how do I fix this?

task main()
{
	wait1Msec(2000);
	bLCDBacklight = true;
	clearLCDLine(0);
	clearLCDLine(1);
	wait1Msec(600);
	displayLCDCenteredString(0, "Collins");
	displayLCDCenteredString(1,"Robot");
	wait1Msec(5000);Main Scope Level
	clearLCDLine(0);
	clearLCDLine(1);
	wait1Msec(1000);
	displayLCDCenteredString(0,"Soccer");
	displayLCDCenteredString(1,"Tournament");
	wait1Msec(5000);
	clearLCDLine(0);
	clearLCDLine(1);

	wait1Msec(2000);

	displayLCDCenteredString(0, "I");
	displayLCDCenteredString(1,"am ready!");
	wait1Msec(3000);
	clearLCDLine(0);
	clearLCDLine(1);
	displayLCDChar(0,1,208);
	displayLCDPos(0,3);
	displayNextLCDString("Will C Wood");
	displayLCDPos(1,2);
	displayNextLCDString("VEX Robotics");


	wait1Msec(3000);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
{						
	string mainBattery, backupBattery;

	// An infinite loop to keep the program running until you terminate it, this would be while(true)statement
	{
		clearLCDLine(0);											// Clear line 1 (0) of the LCD
		clearLCDLine(1);											// Clear line 2 (1) of the LCD

		//Display the Primary Robot battery voltage
		displayLCDString(0, 0, "Primary: ");
		sprintf(mainBattery, "%1.2f%c", nImmediateBatteryLevel/1000.0,'V'); //Build the value to be displayed
		displayNextLCDString(mainBattery);

		//Display the Backup battery voltage
		displayLCDString(1, 0, "Backup: ");
		sprintf(backupBattery, "%1.2f%c", BackupBatteryLevel/1000.0, 'V');	//Build the value to be displayed
		displayNextLCDString(backupBattery);

		//Short delay for the LCD refresh rate
	wait1Msec(3000);
}
}
clearLCDLine(0);
clearLCDLine(1);
displayLCDCenteredString(0, "Program Option");
displayLCDCenteredString(1, "is NEXT");
wait1Msec(2000);

clearLCDLine(0);
clearLCDLine(1);

////////////////////////////////////////////////////////////////////////////////////////////////////////////




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

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

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


{
	//Declare count variable to keep track of our choice
	int count = 0;

	//------------- 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, "Autonomous 1");
			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, "Autonomous 2");
			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, "Autonomous 3");
			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, "Autonomous 4");
			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 ---------------------

It’s hard to read your code because the curly brackets are all over the place, but it looks like your functions such as waitForPress() are in task main. Functions have to be located outside of task main. You can then run these functions by typing waitForPress() in your main task or wherever you are using it

That fixed it like a boss, you are great crazycrabman…