BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => AO 0.6.x Custom/Unofficial modules => Topic started by: -Fionn- on February 10, 2009, 01:24:21 pm

Title: Simple Guild Alliance Chat
Post by: -Fionn- on February 10, 2009, 01:24:21 pm
Thanks to Temar and Alreadythere for helping me get this module to work. This is a simple module that makes use of the Say module that comes with the bebot. You must make both bots members of their target bot for this to work. Change TARGET_BOTNAME in the code below to the bot of your alliance guild and then save the file as alliance.php in your modules folder and restart your bot. Get your alliance guild to do the same thing but of course TARGET_BOTNAME for them is the name of your bot instead. It should also be possible to send the messages to more bots by adding this line below the existing one for each extra bot you want to send the message to. Although I can foresee if you add too many bots then you may lose some of the messages due to the flood filter in game, so you may have to add a delay between each tell.

Code: [Select]
$this -> bot -> send_tell("TARGET_BOTNAME", "say " . $name .": ".$message, 0, FALSE);

Note that I don't have a great understanding of php so I mostly went on using code from the say module and adapting it for what I needed this one to do. So I am sure its far from perfect but it works so I'm happy!

To send a message to your allied guild you type "!alliance <message>" in guild chat and the bot sends it to the target guilds bot which relays it to their guild chat.

Code: [Select]
<?php

$Alliance 
= new alliance($bot);

class 
alliance Extends BaseActiveModule
{
var $bot;
var $msg;




function __construct (&$bot)
{
parent::__construct(&$botget_class($this));

$this -> register_command("all""alliance""MEMBER");

$this -> help['description'] = 'Alliance Message Module';
$this -> help['command']['alliance <message>'] = "- Send a message to allied guild.";

}

function command_handler($name$msg$source)
{
$filters "rot13|chef|eleet|fudd|pirate|nofont";
if (preg_match("/^alliance (".$filters.") (.+)$/i"$msg$info))
return $this -> send_message($name$info[2], $info[1]);
else if (preg_match("/^alliance (.+)$/i"$msg$info))
return $this -> send_message($name$info[1]);
else    return "Learn how to use the command. See !help alliance";

}

function send_message($name$message$filter="off")
{
$filter strtolower($filter);

if ($filter <> "off")
{
$message $this -> bot -> core("stringfilter") -> funmode($message$filter);
}

$this -> bot -> send_tell("TARGET_BOTNAME""say " $name .": ".$message0FALSE);
                
$this -> bot -> send_gc("Your message has been sent to allies.");
}
}
?>
Title: Re: Simple Guild Alliance Chat
Post by: keirou on March 25, 2009, 04:20:00 pm
was testing this earlier today, was working fine.
Just went to use it then (i run both bots off my comptuer)

and got this.
http://yfrog.com/4sbotsvj

so it would seem to me that AussieBot, has lost sync of TTLBot, and thus cannot pass on the messages.

TELL]   [INC]   -1: say Leafy: hello lol.
[TELL]   [OUT]   -> -1: I only listen to members of this bot.
[TELL]   [INC]   Miyaichi: hi
[TELL]   [OUT]   -> Miyaichi: /tell Aussiebot !help
[TELL]   [INC]   Miyaichi: !alliance Test
[TELL]   [OUT]   -> ttlbot: say Miyaichi: Test
[GROUP]   [MSG]   [The Aussie Battlers] Aussiebot: Your message has been sent to allies.
[TELL]   [INC]   -1: say Miyaichi: Test
[TELL]   [OUT]   -> -1: I only listen to members of this bot.
[TELL]   [INC]   Miyaichi: whois ttlbot
[TELL]   [OUT]   -> Miyaichi: Ttlbot is a level 5 Tempest of Set :: Online :: [link]Details[/link]

the -1 is ttlbot trying to send a message
both bots are superadmins on eachother, both bots have the file setup as instructed.
Title: Re: Simple Guild Alliance Chat
Post by: Alreadythere on March 26, 2009, 06:05:05 pm
Looks like your bot has trouble with getting the correct UID.

If a reboot alone doesn't help try the following:
- Remove the troubling bot from members/security groups
- Restart the bot that shows -1
- Try adding again

Only thing I can think of right now.
Title: Re: Simple Guild Alliance Chat
Post by: Zweiblum on November 28, 2009, 05:27:11 pm
so u dont have to set up a relay bot to work relaying to bots?
and is it possible to give the msg a prefix?

so thats:

ORgBot: [2ndOrg] blablub

or is it:

Orgbot: blablub

?
SimplePortal 2.3.7 © 2008-2024, SimplePortal