BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => BeBot Hyborian support => Topic started by: kardsen on July 09, 2008, 09:43:28 pm

Title: Bebot /afk = logoff
Post by: kardsen on July 09, 2008, 09:43:28 pm
Whenever a guild member goes AFK the bot post's that the member has logged off.
Title: Re: Bebot /afk = logoff
Post by: Noer on July 09, 2008, 09:47:35 pm
It is a "feature" in the chat server. Nothing I can do about it.
Title: Re: Bebot /afk = logoff
Post by: kardsen on July 09, 2008, 10:07:15 pm
Chat server should recognize the differance between a AFk and a logout.  The chat server differentiates between a logoff and a afk.  As the status change is different
I just need to know what that is called upon.

Example from ragebot
Code: [Select]
global $guildmates,$guildmains,$guildlookup;

/* Already loaded guildmates? If not we currently may logon and receive the status of every buddy */
if ($guildmates[0]&&$guildmates[$args["name"]]) {
/*Do we have a state-change caused by a refresh?*/
if ($guildlookup[$args["name"]]) {
    say("Guildbuddies :: Statuschange caused by a lookup and ignored",1);
}
/*Do we have a statuschange?*/
elseif ($args["status"]!=$args["laststatus"]) {
say ("Guildbuddies :: Buddy ".$args["name"]." changed status from ".$args["laststatus"]." to ".$args["status"],1);
if ($guildmains[$args["name"]])
$main=" (".$guildmains[$args["name"]].") ::";
else
$main="";

#was offline before, so he/she logged on
if     ($args["laststatus"]==0)
$msg=":: ".$args["name"]." :: Level ".$args["level"]." ".classname($args["class"]).":: logged on ::".$main;

#has changed status to 0 => logged off
elseif ($args["status"]==0)
$msg=":: ".$args["name"]." :: Level ".$args["level"]." ".classname($args["class"]).":: logged off ::".$main;

if($args["laststatus"]==0 || $args["status"]==0)
{
              }

#went afk
elseif ($args["status"]==3 && $args["laststatus"]==1)
$msg=$args["name"]." is afk";

#was afk before and is back
elseif ($args["status"]==1 && $args["laststatus"]==3)
$msg=$args["name"]." is back";

send_guild_channel_message(colortext($msg));
say("Guildbuddies :: ".$msg,1);
Title: Re: Bebot /afk = logoff
Post by: Vrykolas on July 09, 2008, 10:26:23 pm
the key is in these lines
Code: [Select]
elseif ($args["status"]==3 && $args["laststatus"]==1)
$msg=$args["name"]." is afk";

#was afk before and is back
elseif ($args["status"]==1 && $args["laststatus"]==3)

that means that the meaning of $args[1] in inc_buddy() in Bot.php (around line 990) is as follows:
0 = Offline
1 = Online
2 = ?
3 = AFK

Hmmm, I wonder what 2 is...

Anyhow I'll look into it, though I'm on reduced free time until the weekend now....
Title: Re: Bebot /afk = logoff
Post by: Temar on July 09, 2008, 11:07:14 pm
some 1 said somit about logoff when they go on lft maybe thats 2
Title: Re: Bebot /afk = logoff
Post by: Vhab on July 09, 2008, 11:32:30 pm
I can confirm 2 is LFT.
Also, AFK takes priority over LFT. Meaning, if someone is AFK, the status will remain AFK regardless of being on LFT or not.
Title: Re: Bebot /afk = logoff
Post by: Noer on July 10, 2008, 01:37:56 pm
Thanks - this has been fixed in latest revision. :-)
Title: Re: Bebot /afk = logoff
Post by: kardsen on July 14, 2008, 07:40:42 pm
Is there anyway in a upcoming release you can make it state in guild chat when someone goes /afk  ?

I know there is a !afk command.  But it would be simpler for the guild if they could just use the /afk command in game and have the bot pick it up.
Title: Re: Bebot /afk = logoff
Post by: Vrykolas on July 14, 2008, 10:13:31 pm
it would be possible using a modified version of Sources/Bot.php and Main.php
change Bot.php like this (around line 1054)
Code: [Select]
elseif ($args[1] == 3)
{
// Person is AFK
return;
}
to
Code: [Select]
elseif ($args[1] == 3)
{
// Person is AFK
$this -> bot -> send_gc("$user has gone AFK");
return;
}

and Main.php (line 364) from this:
Code: [Select]
case 20:
// Silently ignore for now (AOCP_CLIENT_NAME)
break;
to
Code: [Select]
case 20:
// Silently ignore for now (AOCP_CLIENT_NAME)
if ($bot -> aoc -> buddy_exists($args[0]))
$bot -> aoc -> buddy_remove($args[0]);
$bot -> aoc -> buddy_add($args[0]);
break;

(it's very similar to the method I use for my autogratz script, but based on the latest svn version of the files)

there is 1 flaw with this atm, if the player forgets they are AFK and starts running around, levelling etc it will send an AFK message to guild chat on each change - I really need to come up with a better method of detecting these changes only when they first occur...
Title: Re: Bebot /afk = logoff
Post by: Noer on July 14, 2008, 10:29:26 pm
I actually did make the changes in Bot.php to support the /afk events. You can catch these events in the AFK module. However theres a lot of issues with people going on LFG, taking LFG off etc. And I didn't have time to fix those.

We are currently testing an upgrade of the whole bot to be based on BeBot 0.5.2 and I don't really wanna make a major change in the code before we apply that to the trunk. :)

But Vrykolas has done a good job and I think we can add it to the trunk very soon.
Title: Re: Bebot /afk = logoff
Post by: kardsen on July 14, 2008, 10:47:51 pm
hmm, 

I'll hold off on changing this this.
I'll just be content with it not saying people have logged off all the time.


As far as Vry's problem...
Couldn't you make a new SQL table that remembers the players LAST state.  so if the last state is different than the current state it changes it.. Otherwise output nothing?

Hrmm..  Something like that would take me a couple weeks...
but hey!  thats why you guys are in charge of making bebot and I just tinker  :)
SimplePortal 2.3.7 © 2008-2025, SimplePortal