colobot-data/help/tremote1.txt

40 lines
1.6 KiB
Plaintext

\b;Exercise
Remote control a robot using an \l;information exchange post\u object\exchange;, so it will transport \l;uranium ore\u object\uranore;.
The main actors of this exercise are¦:
1) A \l;sniffer\u object\botsr; (can't carry anything).
2) An \l;information exchange post\u object\exchange; that receives information from a sender and then transmits it to a receiver.
3) A \l;grabber\u object\botgr; which waits for orders from the exchange post. You have no way control this robot directly.
\image tremot1a 16 8;
An information exchange post stores "name/value" couples. To control the "slave" robot we use just one couple¦:
name="order", valuer=order number
The slace robot understands following orders¦:
\c;
1 -> grab(); // take an object
2 -> drop(); // drop an object
3 -> move(10); // move 10 meters forward
4 -> move(-10); // move 10 meters backwards
\n;
To instruct the slave to move forward 10 meters all you have to do is¦:
\c;\s; \l;send\u cbot\send;("order", 3, 100); // order 3 -> "move(10)"
\n;
After the send instruction we wait for 5 seconds to be sure the move is done.
\c;\s; \l;wait\u cbot\wait;(5);
\n;
Remark: There is a better way for waiting the order has been executed, but we'll see this later in exercise "Remote Control #2".
To finish the exercise you must¦:
1) Take the uranium ore
2) Move forward by 10 meters
3) Drop the uranium ore
4) Move backwards by 10 meters
It's up to you to write the program.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.