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
making bot commands

 
Post new topic   Reply to topic Printable version
 View previous topic  anti checking not working? Post :: Post hw to bot on animaro?????????????  View next topic  
Author Message
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Sun Feb 11, 2007 3:42 am    Post subject: making bot commands Reply to topic Reply with quote

Hi, i was just wondering if someone could show me some code and tell me where to put it for making a command (e.g. !announce ) start a countdown and trigger events.
Back to top
View users profile Send private message Add User to Ignore List
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Sun Feb 11, 2007 5:51 am    Post subject: Reply to topic Reply with quote

You have a file command.cpp with this part:
Code: Show/Hide

void botInfo::gotCommand(Player *p, Command *c)
{
   if (!p) return;
   if (!c) return;

   switch (p->access)
   {
   case OP_Duke:
   case OP_Baron:
   case OP_King:
   case OP_Emperor:
   case OP_RockStar:
   case OP_Q:
   case OP_God:
   case OP_Owner:
      {   // Owner-level commands
      }
   case OP_SysOp:
      {   // SysOp-level commands
      }
   case OP_SuperModerator:
      {   // SuperModerator-level commands
      }
   case OP_Moderator:
      {   // Moderator-level commands
      }
   case OP_Limited:
      {   // Limited-level commands
      }
   case OP_Player:
      {   // Player-level commands
      }
   }
}


You can add this into the code:
Code: Show/Hide

if (c->check("announce")) //if command name is announce
{
   countdown[0] = 5;  // set countdown0 to 5 seconds
   sendPrivate(p, "message");  // Send in private something back to the player who triggered the command.
}


So you get this:
Code: Show/Hide

void botInfo::gotCommand(Player *p, Command *c)
{
   if (!p) return;
   if (!c) return;

   switch (p->access)
   {
   case OP_Duke:
   case OP_Baron:
   case OP_King:
   case OP_Emperor:
   case OP_RockStar:
   case OP_Q:
   case OP_God:
   case OP_Owner:
      {   // Owner-level commands
      }
   case OP_SysOp:
      {   // SysOp-level commands
      }
   case OP_SuperModerator:
      {   // SuperModerator-level commands
      }
   case OP_Moderator:
      {   // Moderator-level commands
      }
   case OP_Limited:
      {   // Limited-level commands
      }
   case OP_Player:
      {   // Player-level commands
         if (c->check("announce")) //if command name is announce
         {
            countdown[0] = 5;  // set countdown0 to 5 seconds
            sendPrivate(p, "message");  // Send in private something back to the player who triggered the command.
         }
      }
   }
}


Also alot is explained here
You need to add the event triggering manualy in (usualy) spawn.cpp
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Sun Feb 11, 2007 8:41 am    Post subject: Reply to topic Reply with quote

cool thanks for your help, was just unsure of it thats all.. and i have been following the mervbot tutorial.. it just doesnt explain properly.

And also, if i wanted it to show periodically count down from 5 minutes, and display every minute after the command has been typed, how would i go about that?

And one more thing, what do you mean add the event trigger manually?

sorry for all the questions.. just new at this icon_smile.gif and thanks for all your help so far.
Back to top
View users profile Send private message Add User to Ignore List
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Mon Feb 12, 2007 1:15 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide

if (c->check("announce")) //if command name is announce
{
   countdown[0] = 5 * 60;  // set countdown0 to 5 * 60 = 5 minutes
   sendPrivate(p, "message");  // Send in private something back to the player who triggered the command.
}


Put this in command.cpp

Then in spawn.cpp you see this:
Code: Show/Hide

case EVENT_Tick:
{
   for (int i = 0; i < 4; ++i)
      --countdown[i];
}
break;


Which can be changed into:
Code: Show/Hide

case EVENT_Tick:
{
   for (int i = 0; i < 4; ++i)
      --countdown[i];

   if (countdown[0] == 300) // if countdown is 5 minutes
   {
      sendPublic("5 Minutes");
   }
   else if (countdown[0] == 240) // if countdown is 4 minutes
   {
      sendPublic("4 Minutes");
   }
   else if (countdown[0] == 180) // if countdown is 3 minutes
   {
      sendPublic("3 Minutes");
   }
   else if (countdown[0] == 120) // if countdown is 2 minutes
   {
      sendPublic("2 Minutes");
   }
   else if (countdown[0] == 60) // if countdown is 1 minute
   {
      sendPublic("1 Minutes");
   }
   else if (countdown[0] == 0) //is countdown is over (0 seconds)
   {
      sendPublic("0 Minutes (Countdown over)");
   }
}
break;

This sais how many minutes left in pubchat.

By adding it manualy i mean you need to add it yourself coz since there are so many events i cant give an example. (well i can but im to lazy to post them all)
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Thu Feb 15, 2007 9:17 am    Post subject: Reply to topic Reply with quote

Thanks for all your help, i have it all figured out now. icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Thu Feb 15, 2007 10:30 am    Post subject: Reply to topic Reply with quote

No problemo.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
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: 285 page(s) served in previous 5 minutes.

phpBB Created this page in 0.524649 seconds : 31 queries executed (88.3%): GZIP compression disabled