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

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

Author Topic: Split buddy list by alphabet letters  (Read 2885 times)

0 Members and 1 Guest are viewing this topic.

Offline Civildeath

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Split buddy list by alphabet letters
« on: October 17, 2007, 09:24:39 am »
Request:
Please help me with syntax in PHP so that the bot will only add members to the buddy list if they are in a certain range of the alphabet.  So like one bot would only add members to its buddy list if the members names started with A-G and another bot would only add names starting with H-Z. 

Background:
I'm trying to solve the over 1000 buddy list limit issue.  I already have two bots sharing an online table from two different orgs and that works great.  The problem is that one org is over 1000 members so some members don't get seen that are from that org (the bot toon starts getting errors from AO saying it has exceeded the buddy list limit.)  The org that is less then 1000 always shows up just fine in the shared online table though.  So sharing the online table between bots seems to effectively get around the 1000 limit.

Proposed solution:
I would like to use two bots for the org over 1000 members.  One of the bots would only keep track of A-G and the other bot would keep track of H-Z and then store the results in the online table.  I have been trying to figure out the logic/syntax in php to have the bots do this though.
« Last Edit: October 17, 2007, 09:27:27 am by Civildeath »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Split buddy list by alphabet letters
« Reply #1 on: October 17, 2007, 11:52:14 am »
preg_match("/^[a-g]/im", $name) and preg_match("/^[h-z]/im", $name) should be your friends.

Just one point, FC only shows 1k members in their XML, even if the org is much larger.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Split buddy list by alphabet letters
« Reply #2 on: October 17, 2007, 09:03:52 pm »
I've solved the issue previously by tracking when the bot last saw user X.

On Campalot, if you haven't raided in the last 365 days the bot doesn't add you to the list. Campalot's highly customized BeBot 0.2 though, and the code shows the hackish state of things. ;)

In 0.4 the bot tracks last logon and logoffs, though if the user isn't on the roster they would have to speak in GC before the bot will see them...

Offline Civildeath

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Split buddy list by alphabet letters
« Reply #3 on: October 18, 2007, 10:57:47 pm »
Thanks for the tips ...

So I tried to qualify that people only get added if their name startes with A-M by putting an if statement around the buddy-add command.  It is still adding peoples who name start after M.  I am not sure why though ... I added in a staement to echo the regular expression and it is correctly returning the first letter of the name so it seems like the if statement should be filtering.

if (preg_match("/^[a-m]/im",$member["nickname"]))
{
     if (!$this -> bot -> aoc -> buddy_exists($member["id"]))
     {
     $this -> bot -> aoc -> buddy_add($member["id"]);
     $this -> bot -> log("ROSTER", "BUDDY-ADD", $member["nickname"]);
     }
}

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Split buddy list by alphabet letters
« Reply #4 on: October 18, 2007, 11:17:28 pm »
I think you have to adapt the notify module too, it defines which user stay in the buddy list.

Best check the code for buddy_add() calls in core, and perhaps in modules/Roster.php.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


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 ]

* Who's Online
  • Dot Guests: 241
  • 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