Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] No problem
#1
Hi,

( PLOT TWIST : THAT WAS A SYNTAX ERROR : missing "sens" parameter in radarall )


I'm actually trying to succeed a code battle with a friend.

I would like to try my code against bots, the 2nd "code battle" mission. But I had a problem. My code works against ants. I dont kills them, but I can build an army of robots. But when I try against bots, my robot stop on a call on busy();

Here is the piece of code :

Code:
bool checkTitanium(){
        object[] converters = radarall ( Converter, 0, 360, 0, 500, FilterFriendly|this.me.team );
        if(sizeof(converters)==0){return true;}
        for (int i = 0; i < sizeof(converters); ++i)
        {
            object conv = converters[i];
            bool bu = conv.busy();
            if(bu==true){
                continue;
            }

I play against the red robot, my converter just made a fresh Titanium, so it should be not busy anymore. I play with errmode(0), it just stopped on this word with no feedback.

I've tried to move this call of "busy()" but it seems to be this function...

Thank you for your help Smile
Love from la France
#2
Without errmode(0); it returns "Unable to control enemy units", as it's refering to enemy Converter, but I deleted '|this.me.team' part, as it's probably some custom class that I don't have, so reason might be a bit different in your case.
Still FilterFriendly should IMHO filter enemy Converters from radarall(); results, so I would consider it as a bug.
Spoiler :
[Image: unknown.png]
#3
This.me contains the bot objet. So this.me.team returns the same thing as "this.team" in an "object::" function.
I had problems with this always returning the first robot in "object::" functions, so I only use classes now.

Should it work if ask for "FilterFriendly | MyTeamId" or should I remove the "FilterFriendly" in codebattle (and use it only if My team id is 0) ? In that case, FilterFriendly should be named "FilterBots" or "FilterNoAnts" :p

So it will be the same for "FilterEnemy" : it will not return bots, only ants, am I right ?

So I shoud write something like
Code:
int getFriendlyFilter(){
 if(this.me.team==0)
   return FilterFriendly;
 else return this.me.team;
}
bool checkTitanium(){
       object[] converters = radarall ( Converter, 0, 360, 0, 500, getFriendlyFilter() );
       if(sizeof(converters)==0){return true;}
       for (int i = 0; i < sizeof(converters); ++i)
       {
           object conv = converters[i];
           bool bu = conv.busy();
           if(bu==true){
               continue;
           }

IMHO "busy" should also be available for strategic purpose.


Thank you for your priceless help !!

here is "your reward" :p : https://www.dropbox.com/sh/mpups9y5f00ek...ficial.mp3
Love from la France
#4
You should only have to use FilterFriendly without using your team id. If that still returns, it's likely abug.
#5
In fact, I added my team id in an attempt to fix the problem.

It was crashing already with
Code:
radarall ( Converter, 0, 360, 0, 500, FilterFriendly);

I will try with just my team id, to fix my problem in the current game's behavior.
Love from la France
#6
You are missing the 'sens' parameter.
Code:
radarall ( cat, angle, focus, min, max, sens, filter );

// try this
radarall ( Converter, 0, 360, 0, 500, 1, FilterFriendly);
#7
(12-22-2016, 02:10 PM)melex750 Wrote: You are missing the 'sens' parameter.
Code:
radarall ( cat, angle, focus, min, max, sens, filter );

// try this
radarall ( Converter, 0, 360, 0, 500, 1, FilterFriendly);

You're right,
Thank you !
Love from la France


Forum Jump:


Users browsing this thread: 1 Guest(s)