Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
How would I do this?...

 
Post new topic   Reply to topic Printable version
 View previous topic  Counting turf flags possessed by frequ... Post :: Post Programmers  View next topic  
Author Message
Freakman Bob
Guest


Offline

PostPosted: Wed Feb 02, 2005 3:52 pm    Post subject: How would I do this?... Reply to topic Reply with quote

I want to make a Golf bot that would spawn powerballs at certain places, and that could also be told to warp people with simple commands like :GolfBot:!1hole Freakman Bob.

I'm sure this is considered simple, but I'm the sort of person who figures stuff out, doesn't just go with MERV or something....

Therefore, any suggestions / code?
Back to top
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Wed Feb 02, 2005 4:21 pm    Post subject: Reply to topic Reply with quote

You wrote:
I'm sure this is considered simple, but I'm the sort of person who figures stuff out, doesn't just go with MERV or something....


I'm not sure if I understand what you said there, but whatever, I suggest you learn about C++ and MERV (if you don't know about them already, as I said I can't really find out by reading what you said); Some of us would be glad to help.

No idea how to do the ball spawning, I guess it is possible by letting the bot picking up the balls and releasing it somewhere else.

Something to get you started with the warp command (not sure if your idea really is convenient, but whatever, you asked for it). sa_tongue.gif

Code: Show/Hide
void botInfo::gotCommand(Player *p, Command *c)
{
   // Skipping code to improve readability.

   switch (p->access)
   {
   // ...
   case OP_Moderator:
      {
         // Is the used command "[!|.|@]1hole"?
         if (c->check("1hole"))
         {
            // Did the operator use any parameters?
            if (*c->final)
            {
               // Iterate through the playerlist while comparing c->final (which contains the name of the player who needs to be warped)
               // If it's found, send the *warpto (and maybe another message like "Warp'd!") to the player.
               // Otherwise if the player wasn't found, you could send an error message if you want.
            }
            // Error message?
         }
      }
      // ...   
   }
}
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Wed Feb 02, 2005 6:17 pm    Post subject: Reply to topic Reply with quote

no need to iterate through the list solo, you already have the player*

try this:

Code: Show/Hide

void botInfo::gotCommand(Player *p, Command *c)
{
   // Skipping code to improve readability.

   switch (p->access)
   {
   // ...
   case OP_Player:
      {
         // Is the used command "[!|.|@]1hole"?
         if (c->check("1hole"))
         {
                 sendPrivate(p,"*warpto 512 512");
         }
         else if (c->check("2hole"))
         {
                 sendPrivate(p,"*warpto 600 600");
         }
      }
      // ...   
   }
}

_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Wed Feb 02, 2005 6:23 pm    Post subject: Reply to topic Reply with quote

No you don't have the Player *, he doesn't want the player (or operator) who used the command to be warped, he wants a certain player in the arena to be warped.

He wrote:
that could also be told to warp people with simple commands like :GolfBot:!1hole Freakman Bob.


But, I may be wrong. icon_confused.gif
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Wed Feb 02, 2005 6:37 pm    Post subject: Reply to topic Reply with quote

you're right... and that's a silly way to do it... but I guess I feel obligated to post the correct code now icon_sad.gif

Code: Show/Hide


void botInfo::gotCommand(Player *p, Command *c)
{
   // Skipping code to improve readability.

   switch (p->access)
   {
   // ...
   case OP_Moderator:
      {
         // Is the used command "[!|.|@]1hole"?
         if (c->check("1hole"))
         {
             bool found = false;

             for (_listnode <Player> *parse = playerlist->head;parse;parse = parse->next)
            {
                 if (strcasecmp(c->final,parse->item->name) == 0)
                 {
                     sendPrivate(parse->item,"*warpto 512 512");
                     found = true;
                     break;
                 }
            }

             if (!found)
                 sendPrivate(p,"Player not found in arena.");
             else
                 sendPrivate(p,"Player found and warped.");
           
         }
      }
      // ...   
   }
}



A more elegent solution would involve checking for substrings of names so you don't have to type the whole name. Hockey Zone has a miniputt bot that does something similar to what it looks like you're developing.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Wed Feb 02, 2005 11:29 pm    Post subject: Reply to topic Reply with quote

Or you could just set up a TM Baw (?) with warp points set up like in Assault: Overlord from UT GOTY
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 454 page(s) served in previous 5 minutes.

phpBB Created this page in 0.522034 seconds : 30 queries executed (89.7%): GZIP compression disabled