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: Question about multiple bots with same code/database  (Read 6715 times)

0 Members and 1 Guest are viewing this topic.

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Question about multiple bots with same code/database
« on: February 18, 2010, 09:52:03 pm »
I'm trying to figure out if it is possible to have 2 bots running with the same name, but different dimensions, using the same code and database.

I know how to run multiple bots using the <botname>.bot.conf. But the issue is that the 2 bots have the same name.

Any thoughts?

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Question about multiple bots with same code/database
« Reply #1 on: February 18, 2010, 10:29:26 pm »
Offhand I cannot recall all of the code relating to this, but if memory serves this should be no issue provided you take some precautions.

First off, the <botname>.bot.conf does not need to match the actual name of the bot ingame. You could name them 1.bot.conf and 2.bot.conf. It basically only matters in relation to the name argument you give when starting the bot.

The second thing which should be the only real issue is the database table prefix.
You will need to setup a mysql.conf for each bot where you manually specify the prefix so they do not end up trying to use the exact same tables for users etc.

Other than that, I can't think of anything.
BeBot Founder and Fixer Kingpin

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Question about multiple bots with same code/database
« Reply #2 on: February 18, 2010, 11:12:02 pm »
Thanks for the response, however I did try that. I created:

bot1.bot.conf
bot2.bot.conf

bot1.mysql.conf
bot2.mysql.conf

Inside bot1.mysql.conf I set "$table_prefix=bot1", but when the tables were created, they were prefixed by the actual $bot_name set in the conf files.

Did I name my mysql.conf file correctly? In my "shortcut" to launch the bot I call "startbot.bat bot1", do I need additional command line parameters?

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Question about multiple bots with same code/database
« Reply #3 on: February 18, 2010, 11:30:08 pm »
I just looked in MySQL.php and it is using $botname so it's ignoring the command line input. I'm still using 0.6.5, do you know if this is corrected in 0.6.7?

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Question about multiple bots with same code/database
« Reply #4 on: February 19, 2010, 12:57:04 am »
MySQL.php reads:
Code: [Select]
if (!isset($table_prefix))
{
$this -> table_prefix = strtolower($botname);
}
else
{
$table_prefix = str_ireplace("<botname>", strtolower($botname), $table_prefix);
$this -> table_prefix = $table_prefix;
}

If prefix is NOT set, it uses botname yes., else no.

Try starting on a clean database and make sure that the table prefix is not commented out.
BeBot Founder and Fixer Kingpin

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Question about multiple bots with same code/database
« Reply #5 on: February 19, 2010, 05:13:02 pm »
That's true but the issue is here:

Code: [Select]
/*
Load up config
*/
$botname_mysql_conf = "conf/" . $botname . ".MySQL.conf";

if (file_exists($botname_mysql_conf))
include $botname_mysql_conf;
else
include "conf/MySQL.conf";

The config file it loads up is based on the bot name, not the name that we are passing in through the command line. Because of this, it will try to use the same config file for both bots.

Offline Shelly

  • BeBot Apprentice
  • ***
  • Posts: 192
  • Karma: +0/-0
Re: Question about multiple bots with same code/database
« Reply #6 on: February 20, 2010, 02:47:48 am »
In your bot1.MySQL.conf file did you set the prefix differently for each bot? Such as...

        /*
        Database table prefix
        The bot will use <botname> as prefix on default, you only need to change this entry if you
        want a different prefix or none at all, in which case you have to set it to an empty
        string ("").
        If you want a different or no prefix you will have to uncomment the line below by removing
        the // in front of it and set it to the wished value.
        */
        $table_prefix = "Bot1";

        /*
        Master prefix table.
        This is the mastertable containing information about all tablenames and whether those use
        or don't use a prefix. Only uncomment the line below by removing the // in front of it if
        you want to use a different mastertable then botname_tablenames, which is used on default.
        */
        $master_tablename = "Bot1_tablenames";

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Question about multiple bots with same code/database
« Reply #7 on: February 21, 2010, 12:27:59 am »
You are absolutely correct Snarf.

I'll have a look at it as soon as get some time.
BeBot Founder and Fixer Kingpin

Offline clashbot

  • BeBot Expert
  • ****
  • Posts: 295
  • Karma: +0/-0
    • Ascension's Home
Re: Question about multiple bots with same code/database
« Reply #8 on: February 21, 2010, 05:16:26 am »
could you modify the mysql.php to reflect the same way that the bot.conf is called such as?
Code: [Select]
/*
If an argument is given, use that to create the config file name.
*/
if ($argc > 1)
{
$conffile = ucfirst(strtolower($argv[1])) . ".Bot.conf";
}
else
{
$conffile = "Bot.conf";
}

I guess passing the argument as variable used in the mysql.php

Offline Heinz64

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Question about multiple bots with same code/database
« Reply #9 on: April 29, 2010, 10:45:23 pm »
hi, i have the same problem with the 2 bots with same name and different dims..

i changed my bot to load the correct *.mysql.conf now. but there are new problems ..

- the modules.ini is created with the botname (i think, this can be ignored if same config for both bots )
- the `xxx_tablenames` is created with the botname too
- some tables like 'whois' are created without db-prefix, good for same dim, bad for different dims ^^


is there no other possibility for a relay between 2 or more dimensions without using irc and without writing a new version of this bot? tell and priv group don't work across the servers :(

ps: why are there 2 checks about the mysql.conf ?
pps: i someone wants, i can post my modifications, but they aren't very nice i think  :-X

 

* 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: 288
  • 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