colobot-data/help/cbot/E/extern.txt

31 lines
754 B
Plaintext
Raw Permalink Normal View History

\b;Instruction \c;extern\n;
The \c;extern\n; instruction determines the \l;function\u cbot\function; that acts as main program of a robot. The name of the function declared with \c;extern\n; will apear in the program list in the lower left corner of the screen.
\c;
\s;extern void object::MowDown( )
\s;{
\s; while ( true )
\s; {
\s; fire(1);
\s; turn(10);
\s; }
\s;}
\n;
If the program contains other functions, only the main function must be preceded by \c;extern\n;.
\c;
\s;extern void object::Square( )
\s;{
\s; for ( int i=0 ; i<4 ; i++ )
\s; {
\s; Line(10);
\s; }
\s;}
\s;
\s;void object::Line(float dist)
\s;{
\s; move(dist);
\s; turn(90);
\s;}
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.