I think you could circumvent this problem entirely by having a variable that you set before the match and then upload, but I would get it if you don’t want to re-upload your code every time. It worked for me, but I also had a relatively simple auton program.
So I found the solution, all I needed to do was put the if statement in a while (1) loop. The code would read:
Essentially this repeats the loop until the Brain.Screen.Pressing() evaluates to true, then sets the x and y coordinates and finally, breaks the loop to prevent the loop from running into auton. There is one possible caveat that if you don’t select a program, you will not be able to move at all during the match, but I’m sure some sort of fail safe could be implemented, or just don’t forget to pick a program
If I’m not mistaken, you can also use events that will slightly help with processing speed:
Brain.Screen.pressed([]() {
Press_X = Brain.Screen.xPosition();
Press_Y = Brain.Screen.yPosition();
});
That assumes that lambda works in VEX C++. I haven’t tested it yet, but if VEX doesn’t support C++ 11, you could use a separate function:
void onScreenPressed(){
Press_X = Brain.Screen.xPosition();
Press_Y = Brain.Screen.yPosition();
}
Brain.Screen.pressed(onScreenPressed);