BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: Wanuarmi on December 03, 2005, 07:12:33 am
-
Can I do $this -> bot -> $commands["tell"]["command"] or something?
-
$this -> bot -> commands["tell"]["COMMAND"] -> FUNCTION CALL IN OTHER MODULE
-
great thanks :)
-
hmm.. would that work for things like IRC where there is no actual command to send a line to irc that way?
i've just used $this -> bot -> irc -> message() from TowerAttack.php and am waiting to see if it works (it seems that it should, though, because the main bot class knows what $irc is..)
the $this -> bot -> commands array is handy when the modules don't have a declaration in the bot class, and the command is actually accessable via tell, like $this -> bot -> commands["tell"]["online"] from within the irc module, since there's no $this -> [bot ->] online thingie.
edit: just realized i can use $this -> bot -> commands["tell"]["irc"] -> message() heh
but is that better or worse than doing $this -> bot -> irc -> message() ? guess i'll find out when there's a tower attack ;p
/the Aka noob
-
welp doesnt work either way so im outta ideas.
-
heh im gonna have to make a local function in the irc class and have it call $this -> irc -> message() arent i..
think that will work?
-
heh im gonna have to make a local function in the irc class and have it call $this -> irc -> message() arent i..
think that will work?
worked perfectly. i am now relaying tower attack messages to irc.
i have also added per-towerfield-target rate limiting into towerattack messages, so it will only send one notice per target per 8 seconds.
i'll post my towerattack.php when i'm home from work, i've also got the color mods done, and have integrated Alreadythere's whois caching function into it.
roxor
-
$this -> bot -> commands["tell"]["COMMAND"] -> FUNCTION CALL IN OTHER MODULE
Would this work for sending information to the Alts command so I can have everything use the "modified" alts instead of the standard one (the one with the seen command built in and stuff)? I'm looking at how Akarah did it in the Online.php module he made but it dosen't seem to follow this same format and I can't seem to figure out how he did it.
-
Ok, I'm still going crazy trying to figure this out. What I'm trying to do is in the Logon_GUILD.php file I'm trying to add an alts part. so it will look something like this:
"Dabaron" (Lvl 193 Engineer Unit Member) logged on :: alts :: Logon message
The structure it has now is fine, except teh alts part. I found one module where it just has an alts function built into it, but I would rather access the alts.php module so if any changes are made to the alts module it affects every reference to alts without having to hunt down everywhere that makes reference and modding them individually. Tried this ( and a few variations) but it dosen't work. It puts a "link" in the message but nothing happens when clicked.
/*
This gets called if a buddy logs on/off
*/
function buddy($name, $msg)
{
if ($this -> start < time())
{
if ($this -> bot -> is_member($name) == 1)
{
$id = $this -> bot -> aoc -> get_uid($name);
if ($msg == 1)
{
if ($this -> last_log["on"][$name] < (time() - 5))
{
$result = $this -> bot -> db -> select("SELECT nickname, firstname, lastname, level, profession, rank_name FROM members WHERE id = " . $id);
$res = "\"" . $name . "\"";
if (!empty($result[0][1]))
$res = $result[0][1] . " " . $res;
if (!empty($result[0][2]))
$res .= " " . $result[0][2];
$res .= " (Lvl " . $result[0][3] . " " . $result[0][4] . " " . $result[0][5] . ") logged on";
$main = $this -> bot -> alts -> main($name);
$alts = $this -> bot -> alts -> get_alts($main);
if (!empty($alts))
$message = "<a href='chatcmd:///tell <botname> <pre>alts $main'>alts</a> ";
else
$message = "";
$res .= " :: " . $message;
$result = $this -> bot -> db -> select("SELECT message FROM logon WHERE id = " . $id);
if (!empty($result))
$res .= " :: " . $result[0][0];
$this -> bot -> send_gc("<font color=#10a5e5>" . $res . "</font>");
$this -> last_log["on"][$name] = time();
}
}
else
{
if ($this -> last_log["off"][$name] < (time() - 5))
{
$this -> bot -> send_gc("<font color=#10a5e5>" . $name . " logged off</font>");
$this -> bot -> send_pgroup("<font color=#10a5e5>" . $name . " logged off</font>");
$this -> last_log["off"][$name] = time();
}
}
}
}
}
-
This is my alts section of Logon:
$main = $this -> bot -> alts -> main($name);
$alts = $this -> bot -> alts -> get_alts($main);
$result = "<font color=CCInfoHeadline>::: " . $main . "'s Alts :::</font>\n\n";
if (!empty($alts))
foreach ($alts as $alt)
{
$result .= "<font color=CCCCTextColor><a href='chatcmd:///tell <botname> <pre>whois $alt'>$alt</a></font>\n";
}
if (empty($alts))
$alts = "";
else if ($main == $this -> bot -> aoc -> get_uname($name))
{
$alts = " :: " . $this -> bot -> make_blob("Alts", $result);
}
else
{
$blobname = $main . "'s Alts";
$alts = " :: " . $this -> bot -> make_blob($blobname, $result); }
$res .= $alts;
-
Yeah, I can code in to pull the alts manually within the module and just display them but that is counter productive to what I am trying to do. I want it to access the already existing Alts.php module if possible so that way if I make a change to the way the alts look (like using the modified alts with the last seen info for example) it will show that in the logon message as well.
-
You can't make a href chatcmd to a word with some text and think that it will magically make a blob. You must use the make_blob command as it shows in my alts section. Once you have a list of alts in an array pass each name of that list through a foreach and .= a string the the name in the format you want. Then pass that string through a make_blob function and add that string to the end of the logon where you want it.
-
I realize that to make my own blob, however I don't want to write the alts functionality into this module and everything, I want it to use the already made alts module.
Is this possible?
-
You have $main and $alts from the alts module. Can you try $this -> bot -> alts -> make_alt_blob($main,$alts) ? Then add the result to the logon text.
-
Yeah, that worked. I can't believe I didn't think of that :-\
Thanks for the help