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: Custom GuildRelay_GUILD  (Read 8398 times)

0 Members and 1 Guest are viewing this topic.

Offline Mawerick

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Custom GuildRelay_GUILD
« 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 - the module
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 :)
« Last Edit: April 13, 2006, 05:55:41 pm by Mawerick »

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #1 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. :)
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Mawerick

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #2 on: April 13, 2006, 05:56:05 pm »
That was a typo  :o
Fixed now  ;)

Offline mookie

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #3 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 ?


Offline Mawerick

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #4 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.

Offline Jaqueme

  • BeBot Rookie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #5 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?

Offline Jaqueme

  • BeBot Rookie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #6 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

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #7 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.

Offline Jaqueme

  • BeBot Rookie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #8 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?

Offline Jaqueme

  • BeBot Rookie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #9 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?
« Last Edit: August 14, 2006, 01:45:27 pm by Jaqueme »

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #10 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-

Offline Jaqueme

  • BeBot Rookie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #11 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

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #12 on: August 18, 2006, 12:44:09 am »
What would I have to change to use this without the colors and WhoisCache modules?

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Custom GuildRelay_GUILD
« Reply #13 on: August 18, 2006, 02:24:42 am »
Nevermind, have the whoiscache thing working now so I will try it from there

 

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