The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.15 (Linux)
File Line Function
/showthread.php 906 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming noob in need.
#1
Hello!
I've returned to Colobot after many years when I saw new feature - Bot Battles.

So, I've instantly tried to build my own program:


Code:
extern void object::OverlordAI01A()
{
    
    object util;
    int c;
    PosLog();
    OVBuildInit();
    
}

void object::OreCheck()
{
    
    util = radar(TitaniumOre, 0, 360, 0, 100);
    if(radar(TitaniumOre, 0, 360, 0, 100) != null)
    {
        c = 1
    }
    else
    {
        c = 0
    }
    
}

void object::BuildInit()
{
    build(Converter);
    OreCheck();
    util.position = orepos;
    
    while(true)
    {
        if(c = 1)
        {
            goto(orepos);
            grab();
            turn(180);
            break;
        }
        else
        {
            turn(180);
            while(c = 0)
            {
                wait(0.1);
            }
            break;
        }
        break;
    }
    
}
So, I'm having error concerning 'util' not declared in OreCheck() altough I've declared it in OverlordAI01A(). Conclusion is that stuff declared in one block is unavailable to the other blocks, which sucks, as I'm using coordinates based system for building and having a colossal brick of position data at the very start of my program generates total mess (that's the PosLog() in first block, which will be unavailable for the rest of the program, I guess).

So, how to allow all blocks to use declared positions, objects etc. from any other block?
Si vis pace, para bellum.



Messages In This Thread
Programming noob in need. - by Quartofel - 12-25-2016, 02:29 PM
RE: Programming noob in need. - by tomangelo - 12-25-2016, 04:14 PM
RE: Programming noob in need. - by Quartofel - 12-25-2016, 04:28 PM
RE: Programming noob in need. - by Quartofel - 12-27-2016, 11:24 PM
RE: Programming noob in need. - by Mrocza - 12-28-2016, 07:55 AM
RE: Programming noob in need. - by Quartofel - 12-28-2016, 12:53 PM
RE: Programming noob in need. - by tomangelo - 12-28-2016, 04:54 PM
RE: Programming noob in need. - by Quartofel - 12-29-2016, 12:50 PM
RE: Programming noob in need. - by krzys_h - 12-29-2016, 01:04 PM
RE: Programming noob in need. - by Quartofel - 12-29-2016, 04:31 PM
RE: Programming noob in need. - by Mrocza - 01-02-2017, 07:24 PM
RE: Programming noob in need. - by krzys_h - 01-02-2017, 08:48 PM
RE: Programming noob in need. - by Mrocza - 01-03-2017, 09:06 AM
RE: Programming noob in need. - by krzys_h - 01-03-2017, 10:02 PM
RE: Programming noob in need. - by tomangelo - 01-03-2017, 11:02 PM
RE: Programming noob in need. - by Mrocza - 01-04-2017, 08:18 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)