collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Is there a way to figure out if character is online within code  (Read 5745 times)

0 Members and 1 Guest are viewing this topic.

Offline ghostdunks

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
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.

Offline Kentarii

  • BeBot Apprentice
  • ***
  • Posts: 153
  • Karma: +0/-0
    • AoC>TV
Re: Is there a way to figure out if character is online within code
« Reply #1 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');

Offline ghostdunks

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Is there a way to figure out if character is online within code
« Reply #2 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....

Offline Drizzurdeen

  • BeBot Apprentice
  • ***
  • Posts: 193
  • Karma: +0/-0
    • Obsidian-Cult
Re: Is there a way to figure out if character is online within code
« Reply #3 on: July 27, 2011, 05:26:25 pm »
why u don't use the mail funktion of the bot ?????

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Is there a way to figure out if character is online within code
« Reply #4 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. :)

Offline ghostdunks

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Is there a way to figure out if character is online within code
« Reply #5 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.

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 91
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal