Colobot Forum - International Colobot Community
Thread Modes mysterious try...catch block - Printable Version

+- Colobot Forum - International Colobot Community (https://colobot.info/forum)
+-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76)
+--- Forum: Colobot: Gold Edition Basics (https://colobot.info/forum/forumdisplay.php?fid=58)
+---- Forum: Help (https://colobot.info/forum/forumdisplay.php?fid=61)
+---- Thread: Thread Modes mysterious try...catch block (/showthread.php?tid=1016)



Thread Modes mysterious try...catch block - Dogmat - 05-31-2018

I tried try...catch block.
And saw strange work that block.
I have two flags: BlueFlag and VioletFlag, for example.
Distance between two flags about 100m.
My Bot moves between these flags.
Code:
extern void object::test()
{
   try
   {
       while(true)
       {
           goto(radar(VioletFlag).position);
           goto(radar(BlueFlag).position);
       }
   }
   catch(energyCell.energyLevel < 0.8)
   {
       message("Energy low");
       goto(radar(PowerStation).position);
   }
}

When Energy is lower 0.8, message "Energy low" appears, but the Bot continues to moves to one of the flags,
and then moves to the PowerStation.

The goto(radar(xxxFlag).position) command is not interrupted
Why?


RE: Thread Modes mysterious try...catch block - krzys_h - 06-01-2018

It's a known bug. That's why it was never officially documented in original Colobot. See https://github.com/colobot/colobot/issues/474