home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2001 November / Gamestar_34_2001-11_cd1.bin / DEMA / colobotdemoe.exe / script / titan3.txt < prev    next >
Text File  |  2001-07-27  |  1KB  |  49 lines

  1. extern void object::CollectTitanium3()
  2. {
  3.     // 1) Variable definition.
  4.     object  item;            // info. about objects
  5.     
  6.     while (true)             // repeat forever
  7.     {
  8.         // 2) Go to the titanium ore and grab it.
  9.         item = radar(TitaniumOre);// look for titanium ore
  10.         goto(item.position);     // go to the position
  11.         grab();                  // grab the titanium
  12.         
  13.         // 3) Go to the converter and drop it.
  14.         item = radar(Converter); // look for converter
  15.         goto(item.position);     // go to the position
  16.         drop();                  // drop the titanium
  17.         move(-2.5);              // step back 2.5 m
  18.         
  19.         // 4) Wait until titanium converted and grabs
  20.         do
  21.         {
  22.             wait(1);              // wait for cube
  23.             item = radar(Titanium, 0, 45, 0, 5);
  24.         }
  25.         while ( item == null );
  26.  
  27.         goto(item.position);
  28.         grab();                   // take it
  29.         
  30.         // 5) Go to free space and drop it
  31.         goto(space(position));    // go to free space
  32.         drop();                   // drop titanium
  33.         
  34.         // If power cell half empty, recharges.
  35.         if ( energyCell.energyLevel < 0.5 )
  36.         {                         // if so:
  37.             item = radar(PowerStation);
  38.             if ( item != null )   // station found ?
  39.             {
  40.                 goto(item.position); // go there
  41.                 while ( energyCell.energyLevel < 1 )
  42.                 {    // until recharged:
  43.                     wait(1);      // wait
  44.                 }
  45.             }
  46.         }
  47.     }
  48. }
  49.