BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => AO 0.6 support => Topic started by: ghostdunks on July 27, 2011, 10:17:14 am

Title: Is there a way to figure out if character is online within code
Post by: ghostdunks on July 27, 2011, 10:17:14 am
Hi, I'm running bebot 0.6.8 and I'm trying to write some code to send tells to a list of characters if they're online.  I can send the tells but I'm having trouble with the code to figure out if a particular character is online or not.

Been going through the code behind the !is module as that seems to do what I need to do, but I can't figure out the code behind it.  Is there a way or function I can call to easily determine if a supplied character name is online? Obviously, there's some working code in the !is module but I can't tap into it, and would rather re-use some working code rather than rewrite it all completely.

Would appreciate any help, or any examples if you can suggest any.
Title: Re: Is there a way to figure out if character is online within code
Post by: Kentarii on July 27, 2011, 03:04:18 pm
To get an array of online users:

Code: [Select]
$online_users = $this->bot->core('online')->list_users('gc');
Title: Re: Is there a way to figure out if character is online within code
Post by: ghostdunks on July 27, 2011, 03:37:52 pm
sorry I might not have been clear in my initial post.

These characters I'm sending the tells to, won't actually be in the bot when I send the tell to them.  The example you gave seems to return me the online users in the gc, which isn't really what I want.  If possible, I want to be able to supply a character name to a function, and for that function to return the online/offline status of that char, or something like that....
Title: Re: Is there a way to figure out if character is online within code
Post by: Drizzurdeen on July 27, 2011, 05:26:25 pm
why u don't use the mail funktion of the bot ?????
Title: Re: Is there a way to figure out if character is online within code
Post by: Glarawyn on July 27, 2011, 08:36:28 pm
Take a look at the Is.php module. Basically if the user isn't on the bot's friend list the only way to do it is to add the user to the bots friend list, get an online status, and remove from the friends list. I think there is a function somewhere in the bot's core-api to do this so you don't have to reinvent the wheel, just don't remember where that function call is. :)
Title: Re: Is there a way to figure out if character is online within code
Post by: ghostdunks on August 11, 2011, 05:38:16 pm
Thanks for the tips everyone, finally got it to work.  I was already looking at the is.php module but calling the functions never worked properly.  Once I had added the characters I wanted to monitor as members of the bot, it started working with just a simple function call to buddy_online or something like that.
SimplePortal 2.3.7 © 2008-2024, SimplePortal