home *** CD-ROM | disk | FTP | other *** search
/ Mega Score 72 / MSCD72.BIN / Demos / Colobot.exe / help / cbot / goto.txt < prev    next >
Encoding:
Text File  |  2001-07-02  |  2.0 KB  |  36 lines

  1. \b;Instruction \c;goto\n;
  2. The instruction \c;goto();\n; instructs the bot to reach a given position.
  3.  
  4. \b;Basic use
  5. The most current use consists in moving the bot to an object located with the instruction \c;\l;radar\u cbot\radar;();\n;. If the information returned by the \c;\l;radar\u cbot\radar;();\n; has been stored in a certain variable, write the name of the variable followed by \c;.position\n; in order to get the position of the object. Here is an example of a program that looks for a \l;titanium cube\u object\titan;, goes to the position and grabs it:
  6. \c;
  7. \s;    item = \l;radar\u cbot\radar;(Titanium);
  8. \s;    goto(item.position);
  9. \s;    \l;grab\u cbot\grab;();
  10. \n;
  11. \b;For specialists
  12. Syntax:
  13. \s;\c;goto ( position, altitude, goal, crash );\n;
  14.  
  15. Tells the robot to go to the given position, avoiding all the obstacles if this is possible. 
  16.  
  17. \t;pos: \c;\l;point\u cbot\point;\n;
  18. Coordinates of the goal position.
  19.  
  20. \t;altitude: \c;\l;float\u cbot\float;\n;
  21. Flight altitude for \l;winged bots\u object\botgj;. The altitude is useful only for \l;winged bots\u object\botgj;. From the initial altitude, the bot climbs higher until it reaches the specified hight. When arriving close to destination, it goes down to touch the ground at the given position. If no value is given, an altitude of 10 meters is the default value. On very short moves, even winged bot stay on the ground. For all bot except winged bots, this parameter is ignored. 
  22.  
  23. \t;goal: \c;\l;int\u cbot\int;\n; (default value \c;0\n;)
  24. This parameter tells the bot how it must reach the goal: 
  25. \c;0\n;  stops exactly at the goal position
  26. \c;1\n;  goes close to the goal position, without stopping.
  27. If no value is given, \c;1\n; (precision) is the default value. 
  28.  
  29. \t;Return value: \c;\l;int\u cbot\int;\n;
  30. Zero if the bot reached the position, a value different from zero if an error occurred.
  31. \c;== 0 \n;Goal position reached
  32. \c;!= 0 \n;Goal position impossible to reach
  33.  
  34. \t;See also
  35. \l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
  36.