Autonomous program in Driver Control on EasyC

Does anyone know how to program part of an autonomous routine so that it will run when a button on the remote is pressed? I have already made the autonomous action that I want to use in dirver control. I am using EasyC V4. Thanks in advance.

What I would do is probably:

Some Variable = GetJoystickDigital(Whatever Button)
If(Some Variable == 1)
Execute Action

Make sure it all gets inside of your While Loop

You are missing a small check if the button has been released. This could lead to your autonomous code executed twice (if it runs through fast enough). While this isn’t a problem with a code that runs for more than one second, it will be a problem for something that only runs for a few milliseconds.
You might also want to program a button that interrupts the autonomous in case it goes terribly wrong so you are not losing time and/or damaging your robot.