collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Command without the ! possible and how?  (Read 2649 times)

0 Members and 1 Guest are viewing this topic.

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Command without the ! possible and how?
« on: February 11, 2005, 03:53:11 pm »
Hello

Got the Bot running on ! as a command syntax. I new want to make a command that responds without the syntax now how do i go about doing that :)?

else if (preg_match("/^" . $this -> bot -> commpre . "test(.+)$/i", $msg, $info))
            $this -> test($name, $info[1]);

Think i wold need to change the "commpre" into something, but what??

Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
Command without the ! possible and how?
« Reply #1 on: February 11, 2005, 07:04:32 pm »
I'm afraid that if you want this command to respond to tells or privategroup messages it is not (yet) possible.

If you want it to reply to guildchat however it is possible:

At the top:
Code: [Select]
 $myModule = new MyModule();

  $commands["gmsg"][$guild_name][] = &$myModule;


Then in the class:
Code: [Select]
   /*
      This gets called on a msg in the group
    */
    function gmsg($name, $group, $msg)
    {
      if (preg_match("/^thiscommand/", $msg))
      {
        // Code in here.
      }
    }



If you DO need a command that replys to a tell/privgroup without useing the command syntax I'll make a little workaround for you. ;)

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Command without the ! possible and how?
« Reply #2 on: February 13, 2005, 02:48:24 am »
I could be wrong about this, as I haven't taken the time to understand the bot, but you could try taking the "!" and changing it to "" in Bot.conf.
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Blondengy

  • BeBot Creator and Founder
  • BeBot Hero
  • ******
  • Posts: 51
  • Karma: +0/-0
Command without the ! possible and how?
« Reply #3 on: February 13, 2005, 05:48:02 pm »
Yes, but the way I understood it Nesi wants the bot to run on the "!" syntax for all commands but one.

Offline craized

  • Contributor
  • *******
  • Posts: 165
  • Karma: +0/-0
    • http://www.craized.net
Command without the ! possible and how?
« Reply #4 on: February 14, 2005, 08:38:47 am »
Ahh, my mistake, but if you wanted it in privategroup, I believe you can do it using the same workaround as for guild chat, ex.
Code: [Select]

$myModule = new MyModule();

$commands["pvgroup"][][] = &$myModule;


then

Code: [Select]


   /*
      This gets called on a msg in the group
    */
    function prvgroup($name, $group, $msg)
    {
      if (preg_match("/^thiscommand/", $msg))
      {
        // Code in here.
      }
    }




I don't have a copy of the template, so I can't quite remeber if prvgroup is corrent, but the module template does offer a way to listen to all private group chat. As for tells, your'e out of luck for now, unless you do in fact want to do away with your syntax for good.
Trailin [213/14][ADVENTURER][RK2]
Bigburtha [216/17][NT][RK2][FROZEN]
Abeham [199/7][TRADER][RK2][FROZEN]


Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Command without the ! possible and how?
« Reply #5 on: February 14, 2005, 06:23:22 pm »
Made it work by adding another command syntax to the bot :)

Needed it for a loot filter/logger for apfbot and guildbot :)

Works in all channels.
Thanks for the replys

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 377
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal