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

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

Author Topic: multiple prefixes  (Read 7819 times)

0 Members and 1 Guest are viewing this topic.

Offline ideus

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
multiple prefixes
« on: September 21, 2008, 09:40:25 am »
I have been trying to find a way to use multiple prefixes. For example -online and !online will do the same, is there a simple solution in "Bot.conf"
at:   $command_prefix = "-";
that can be modified to have say   $command_prefix = "-" or "!";

Thank you.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: multiple prefixes
« Reply #1 on: September 21, 2008, 01:14:42 pm »
no the codeing its self would have be changed to support multi prefixes
ill make u a simple module to do a check for dif prefix abit later today

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: multiple prefixes
« Reply #2 on: September 21, 2008, 02:10:26 pm »
If prefix is still handled with regexp (it was before), it's easy. Something along the lines of "(?:-|!)" might work if I remember my regexp correctly.
But if prefix isn't handled by regexp anymore, as it might with the newer versions, this wont work!
Too many toons.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: multiple prefixes
« Reply #3 on: September 21, 2008, 07:13:56 pm »
no i think its more simple like $msg[0] == $prefix

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: multiple prefixes
« Reply #4 on: September 22, 2008, 03:09:44 am »
here you go, untested

Code: [Select]
<?php
/*
* Alt_Prefix.php - Module that enables more than 1 Prefix.
*
* Made by Temar
*
* - Coded for Bebot 0.5
*
* You are Free to Improve and Change as Long as My name Stays on it
*
* Add a "_" at the beginning of the file (_ClassName.php) if you do not want it to be loaded.
*
* Version: 1.0
*/


$altprefix = new AltPrefix($bot);


class 
AltPrefix extends BasePassiveModule
{
function __construct(&$bot)
{
parent::__construct(&$botget_class($this));

$this -> register_event("gmsg");
$this -> register_event("tells");
$this -> register_event("privgroup");

$this -> bot -> core("settings") -> create("Core""AltPrefix""""What Other Prefixes are are Allowed seperated by @##@ so . and @ would be .@##@@");
}

function privgroup($name$msg)
{
Return $this -> check($name$msg"pgmsg");
}

function tells($name$msg)
{
Return $this -> check($name$msg"tell");
}

function gmsg($name$msg)
{
Return $this -> check($name$msg"gc");
}

function check($name$msg$origin)
{
$prefix $this -> bot -> core("settings") -> get("Core""AltPrefix");
$prefix str_replace(" """$prefix);
$prefix explode("@##@"$prefix);
foreach($prefix as $pre)
{
if($msg[0] == $pre)
{
$msg[0] = $this -> bot -> commpre;
$this -> bot -> handle_command_input($name$msg$origin);
Return TRUE;
}
}
}
}
?>

Offline ideus

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: multiple prefixes
« Reply #5 on: September 22, 2008, 03:16:31 am »
yeah i've been trying to figure out since a couple of my orgs are very used to the prefix '-' and i linked another org with '!'.  That is no problem, but I recently started a raidbot for the org and for anyone outside the org, I just notice everyone in the org uses '-' and everyone outside the org constantly use '!'.  I really appreciate all your help on this I thought it could have been done by a simple thing added in the bot.conf that I couldn't figure out but when I couldn't figure that out the next thought I had was that I'd have to modify each module somehow in the raidbot to allow one or the other.  For me being noobish at php it'd take me a but but I've been working on it just playing around with php learning new stuff as I go.

I just realized you posted the new module, I'm going to give it a try and really appreciate it.  Thank you very much!

Offline ideus

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: multiple prefixes
« Reply #6 on: September 22, 2008, 03:43:16 am »
:D works great thanks so much for your time!

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


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


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

* Who's Online
  • Dot Guests: 395
  • 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