BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Coding and development discussion => Topic started by: Keepitreal on November 08, 2006, 05:06:20 pm
-
Hy Guys,
i know my englisch will be awefull for you but i need your knowledge. :)
i try to merge the bio.php module in this way that i only have to drag and drop the Solid Bio Clump into the Chat/Tell and get a result without adding a !bio in front of the Item.
Is there any way?
Greetz Keepitreal
-
Yes and no for the "easy" part.
You need to recode almost all the module summed up. Read from the tells/pgroup, and if the "input" preg_matches the regex for the Bio... then continue and edit the function for determining the type of bio.
imo, it's just easier to use the one that works :P
-
You would have to add commands and the functions that would go with them:
$commands["gmsg"][$guild_name][] = &$blah;
$commands["privgroup"][] = &$blah;
function gmsg($name, $group, $msg)
function privgroup($name, $msg)
Then you would have to write a regular expression to match it, which is already done in Bio.php so no big deal.
So you would have code that looks like:
function gmsg($name, $group, $msg)
{
if (preg_match("/<a href=\"itemref:\/\/([0-9]+)\/([0-9]+)\/([0-9]+)\">Solid Clump of Kyr'Ozch Bio-Material<\/a>/i", $msg, $info))
{
$this -> bot -> send_gc($this -> make_bio($info[2], $info[3]));
}
}
function privgroup($name, $msg)
{
if (preg_match("/<a href=\"itemref:\/\/([0-9]+)\/([0-9]+)\/([0-9]+)\">Solid Clump of Kyr'Ozch Bio-Material<\/a>/i", $msg, $info))
{
$this -> bot -> send_gc($this -> make_bio($info[2], $info[3]));
}
}
The downside of doing this is that your bot will not check every line of text sent to guild chat and the private group to see if it is a clump of bio material, instead of only checking lines that start with the command prefix.
Oh, and I have no idea if this will actually work. It's not like I tested it.