Colobot Wiki

The errmode(); instruction allows you to chose if the program should stop when an error occurs in one of the following instructions: goto, move, grab, drop, etc.

For specialists Syntax: errmode ( mode );

Normally the program is stopped when an error occurs. If you use the instruction errmode(0); at the beginning of the program, the instructions listed above return a value different from zero if the instruction could not be performed.

mode: float (1 per default) Error treatment mode. 0 -> continues program execution and returns a non zero value 1 -> stops the program (default behavior)

Example 1: errmode(0); while ( goto(pos) != 0 ) {     wait(2); }

Example 2: errmode(0); int err; err = goto(pos); if ( err != 0 ) {     goto did not perform correctly ...     take some appropriate action ... }