The instruction \c;grab();\n; instructs the bot to use the operating arm to grab an object located on the ground, on the platform of a building or on the power cell location of a bot.
\b;Basic use
The instruction \c;grab();\n; written in this form grabs the object located in front of the bot. Here is a short program that grabs an object in front of the bot and drops it 5 meters further:
\c;
\s; grab();
\s; \l;move\u cbot\move;(5);
\s; \l;drop\u cbot\drop;();
\n;
\b;For specialists
Syntax:
\s;\c;grab ( oper );\n;
This instruction appeals to the operating arm of a \l;grabber bot\u object\botgr;, in order to grab the closest object.
Oper indicates where the bot should look for an object to grab. If no indication is given, the object is picked up in front of the bot.
\c;InFront \n; Grabs in front (default value).
\c;Behind \n; Grabs behind.
\c;EnergyCell\n; Grabs the bot's own power cell.
\t;Return value: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;grab();\n;.
\c;== 0 \n;an object was grabbed
\c;!= 0 \n;error, no object was grabbed
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.