BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Mawerick on April 13, 2006, 07:18:15 am

Title: Custom GuildRelay_GUILD
Post by: Mawerick on April 13, 2006, 07:18:15 am
This is a custom version of the bundled GuildRelay_GUILD module.
It supports multiple relay targets, and is able to communicate with IGN bots.

To get it working, a few changes has to be made to some files.

First, change every occurrence of $guild_relay_target to $guild_relay, and in the Bot.conf file, change the default value to either true or false.

In Bot.php, add the following:
Code: [Select]
/*
* Send a message to connected bots
*/

function send_relay($msg)
{
if ($this -> guild_relay == true)
{
$relays = $this -> db -> select("SELECT botname,bottype FROM "
. $this -> get_tablename("relay_bots") . " WHERE verified = '1'");
if (!empty($relays))
{
foreach($relays as $relay)
{
if ($relay[1] == 'BeBot')
$this -> send_tell($relay[0], "!gcr " . $msg, 0, false);
else if ($relay[1] == 'IGN')
$this -> send_tell($relay[0], "transmit " . $msg, 0, false);
}
}
}
}
(This is mostly for convenience...)

In the inc_tell function, add the following:
Code: [Select]
else
{
$comms = array_keys($this -> commands["relay"]);
for ($i = 0; $i < count($comms); $i++)
{
if ($comms[$i] == "guild")
{
$this -> commands["relay"]["guild"] -> relay ($user, $args[1]);
$i = count($comms);
$found = true;
}
}
}
after the end of the if (!isset($this -> other_bots[$user])) { [..snip..] } code.
This allows IGN bots to connect.

Chance every occurance of
Code: [Select]
if ($this -> bot -> guild_relay_target)
{
$this -> bot -> send_tell($this -> bot -> guild_relay_target, $msg, 0, false);
}
to
Code: [Select]
$this -> bot -> send_relay($msg);where $msg is whatever the code previously sent out, without the "<pre>gcr " bit. This is added by send_relay, depending in what bot it's relaying to (!gcr for bebot, transmit for IGN).

Then get the actual module here:
http://www.wrongplace.net/ao/BeBot/GuildRelay_GUILD.zip (http://www.wrongplace.net/ao/BeBot/GuildRelay_GUILD.zip) - the module
http://www.wrongplace.net/ao/BeBot/guildrelay_help.zip (http://www.wrongplace.net/ao/BeBot/guildrelay_help.zip) - the helpfile

Note:
This module uses AlreadyThere's custom Colors and WhoisCache modules, aswell as his get_tablename function.

Any IGN bot you intend to connect to must be added in the other_bots variable.

Hope it helps someone :)
Title: Re: Custom GuildRelay_GUILD
Post by: Xenixa on April 13, 2006, 05:28:02 pm
Not sure if it was intended or a typo, but that function send_relay($msg) you wrote shouldn't be put in bot.conf but rather inside the Bot Class in bot.php between the function send_gc() and function inc_tell() for best evaluation during runtime. :)
Title: Re: Custom GuildRelay_GUILD
Post by: Mawerick on April 13, 2006, 05:56:05 pm
That was a typo  :o
Fixed now  ;)
Title: Re: Custom GuildRelay_GUILD
Post by: mookie on June 24, 2006, 07:15:57 pm
Can you include the bot.php and other files which are modified in the .zip

The line where changing -
Code: [Select]
if ($this -> bot -> guild_relay_target)
{
$this -> bot -> send_tell($this -> bot -> guild_relay_target, $msg, 0, false);
}
to
Code: [Select]
$this -> bot -> send_relay($msg);

is unclear.. what file to modify ?

Title: Re: Custom GuildRelay_GUILD
Post by: Mawerick on July 05, 2006, 07:17:40 pm
[...] what file to modify ?



That depends on what modules you use.
As I stated, change _any_ occurance of that code. That means anywhere, in any file.
Title: Re: Custom GuildRelay_GUILD
Post by: Jaqueme on August 14, 2006, 03:23:22 am
Okies, I'm trying this, and I'm getting close, but I'm not there yet.

Bebot is getting the chat from my IGN bot, but it's not relaying it to orgchat, i.e., I can see it in the cmd window, but not ingame.  Bebot is also generating a /tell bebot !help to the IGN bot everytime someone talks on the IGN bot, but the IGN bot isn't getting that tell from Bebot.

Also, in the !connect menu for the IGN bot it says it's searching for bebot on IGN network.

Now, I couldn't find any instances of $guild_relay_target  or
if ($this -> bot -> guild_relay_target)
{
   $this -> bot -> send_tell($this -> bot -> guild_relay_target, $msg, 0, false);
}  using the find command in any non .txt or .dll file in Bebot.  Any idea why?  And could that be causing my problem?
Title: Re: Custom GuildRelay_GUILD
Post by: Jaqueme on August 14, 2006, 04:30:08 am
Hmmm, now I seem to be getting a:
Fatal error: Call to undefined method Bot::get_tablename() in C:\BeBot1\modules\
GuildRelay_GUILD.php on line 23
when I start the bot and it tries to load the new module
Title: Re: Custom GuildRelay_GUILD
Post by: Alreadythere on August 14, 2006, 10:58:29 am
Either remove all calls to get_tablename(), or add the following code to your Bot.php inside the bot class:
Code: [Select]
function get_tablename($table)
{
  return $table;
}

That's a custom function to allow prefixes to tablenames, something similar will be supported in the next version of bebot.
Title: Re: Custom GuildRelay_GUILD
Post by: Jaqueme on August 14, 2006, 01:12:21 pm
Thanks for the help.  Unfortunately, I know very little about php.  I've heard of the bot class, and I think I can find it in bot.php, but could you explain it a little more simply?
Title: Re: Custom GuildRelay_GUILD
Post by: Jaqueme on August 14, 2006, 01:39:48 pm
Ok, I put the new function after
             /*
   Constructor:
   Prepares bot.
   */

and before
function Bot($uname, $pwd, $botname, $dim, $botversion, $botversionname, $other_bots, &$aoc, &$irc, &$db, &$commands, $commprefix, &$cron,

$crondelay, $telldelay, $maxsize, $recontime, $guildbot, $guildname, $guildid, $tellcolor, $groupcolor, $log, $log_path)


Bebot loads and runs now.  But when I try to !connect bebotname  or !connect ign ignname, I get:
Fatal error: Call to a member function lookup() on a non-object in C:\BeBot1\mod
ules\GuildRelay_GUILD.php on line 302
and it knocks bebot offline.

Also, the !guildrelay command seems disabled now.  I can see bebot getting the command, but it doesn't acknowledge it ([Bebot] Guildrelay off)

Any ideas?
Title: Re: Custom GuildRelay_GUILD
Post by: jjones666 on August 14, 2006, 03:07:57 pm
Note:
This module uses AlreadyThere's custom Colors and WhoisCache modules, aswell as his get_tablename function.

I assume lookup() is the call for WhoisCache (more info here: http://bebot.link/index.php/topic,223.0.html)

If not using WhoisCache, the lookup's would need to be replaced with the old get_site() function (as in standard Bebot 2.6).

-jj-
Title: Re: Custom GuildRelay_GUILD
Post by: Jaqueme on August 14, 2006, 03:11:48 pm
Ahh, so I have to add them first.  KK, I'll give that a shot after work.  Thanks
Title: Re: Custom GuildRelay_GUILD
Post by: Dabaron on August 18, 2006, 12:44:09 am
What would I have to change to use this without the colors and WhoisCache modules?
Title: Re: Custom GuildRelay_GUILD
Post by: Dabaron on August 18, 2006, 02:24:42 am
Nevermind, have the whoiscache thing working now so I will try it from there
SimplePortal 2.3.7 © 2008-2025, SimplePortal