I can play a sound file, in a regular program or a competition template, but I want it to play as soon as I turn the robot on. The only thing that works is editing the competition includes so that after the “startup” statement the sound plays, but the competition includes wont save (is this edit even legal?). Furthermore, when I put it at the beginning of the template, there is an error that executable statements are not valid in the main declaration block. How do I make the sound play first?
Firstly, editing the comp included file is not illegal. To include a modified comp includes file define a user includes folder in the RobotC preferences and drop your comp includes file in the defined folder with a slightly different name, then change the name of the #includes file up the top of your program to your new comp includes file.
To put it in the competition template you could put it on the pre-autonomous section. Placing it in the main part of the file will will not work because pre-auto, autonomous and driver control are just definitions for functions and tasks started in the main block somewhere else.
Good Luck