object search(int category);

object search(int category, point center);

object search(int category, float x, float y );


Search functions similarly to radar, but can be centered on locations other than the current bot. When no location argument is given, the search is centered on the executing bot, so:

search( PowerCell );

is equivalent to:

radar( PowerCell );

Return Value:Edit

Returns a reference to the object of the specified category nearest to the specified location, or null if no such object exists.


object conv, cube;

conv = radar( Converter );
if( conv != null )
    cube = search(Titanium, conv.position.x, conv.position.y);
    if( cube == null or distance( cube.position, conv.position ) > 2 )
        //There is no Titanium in the converter, go find some

The above example checks for Titanium at the nearest Converter and calls another function "loadTitanium()" if the Converter is empty (n.b. To be useful, the function should also check for TitaniumOre).

See also.Edit

CBOT Language Radar

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.