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: modified Online.php  (Read 23384 times)

0 Members and 2 Guests are viewing this topic.

MatHack

  • Guest
Re: modified Online.php
« Reply #15 on: March 15, 2006, 03:57:06 pm »
Found a bug where people that were removed from guild would show online, even after they logged off, fix shown below (including Xenixa's bugfix)

Code: [Select]
function buddy($name, $msg)
{
if ($msg == 1)
{
if ($this -> bot -> is_member($name) == 1)
{
if (!isset($this -> bot -> other_bots[$name]))
$this -> guild[$name] = $this -> whois($name);
}
}
else if (isset($this -> guild[$name]))
unset($this -> guild[$name]);
}

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: modified Online.php
« Reply #16 on: March 15, 2006, 05:12:43 pm »
I actually just coded it in the bot to remove them from the bot's buddylist after someone gets kicked (mine's all auto, once kicked from org, removed from members list, and buddylist and a msg in org chat they were kicked)

But I guess mat's works just as good :P
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

MatHack

  • Guest
Re: modified Online.php
« Reply #17 on: March 15, 2006, 05:16:27 pm »
Yeah, I did all that too, but they still show up on the online-list ;)

The problem was that the bot checks if you are a member, if so, it removes you from the online-list if you log off. If you are not a member, it notices that you log off, but because you aren't a member you won't be removed from the online-list.

If you keep your online-list in a DB, it's a lot easier, but BeBot keeps it in internal arrays in Online.php

Offline Naturalistic

  • Contributor
  • *******
  • Posts: 221
  • Karma: +0/-0
Re: modified Online.php
« Reply #18 on: March 15, 2006, 05:19:08 pm »
Ah, good point.

I'll have to check it later, maybe I did something to the online list as well, not sure.
220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified Online.php
« Reply #19 on: March 24, 2006, 01:08:22 pm »
Ahh ok, I see what you did Mat. That one's been bothering me also(ex-Members getting stuck on online list until bot restart). You moved the online msg check to be first rather than be a sub-conditional check of a member. Heh makes perfect sense now.

Now I'm sitting here thinking "Why didn't I think of that?"  :P

Good fix, should be added to SVN copy of Online.php *hint hint, wink wink, nudge nudge*.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: modified Online.php
« Reply #20 on: January 17, 2007, 01:38:29 am »
Compiled with all the fixes and switched to using Glara's new module settings plugin for the display type switch.  Also requires Alreadythere's persistant whois cache.

http://www.jjones.co.uk/files/online.php

-jj-

p.s. moved to the unofficial 0.2.x modules forum as most of the fixes didn't make it to SVN yet.
« Last Edit: January 17, 2007, 01:42:43 am by jjones666 »

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: modified Online.php
« Reply #21 on: January 17, 2007, 06:01:20 am »
Does not work for me. The bot always loads Online.php first and exits with an error because it doesn't know the $this -> bot -> set -> create part in line 53. Works for the other modules you posted. These are in the modules directory, and Glara's settings module is already loaded by the time they are loaded. Is there a way to influence the order in which the core modules are loaded?

Also, kinda unrelated, my "users" complained about the many "has joined the guest channel" and "has left the guest channel" messages we often get during raids and orgmeetings. Took me a while to pinpoint the Online.php. I would have somehow expected that code to be in PrivGroup.php or so. :) Anyways, I removed that for me, but maybe a setting to turn the guestchannel announcements on and off would be cool. If someone gives me a hint on how to make Online.php run with the new settings, I can try to code that myself, too.
« Last Edit: January 17, 2007, 06:08:54 am by pusikas »
Luuv  Bot-Keeper of Vengeance ^^*

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified Online.php
« Reply #22 on: January 17, 2007, 06:15:01 am »
Because files in the /core folder are loaded before the /modules folder and the /core folder is where ModuleSettings.php lives as well as Online.php some tweeking will be needed in Main.php to force ModuleSettings.php to be loaded before Online.php

Either that or MOVE Online.php to the /modules folder for the time being. :) It'll still load and work from there.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified Online.php
« Reply #23 on: January 17, 2007, 06:37:13 am »
Here's another work around that leaves Online.php in the /core folder.
Requires editing of Main.php and moving a couple files. This follows the conventions used in v0.3

First, create a new folder under the root folder for the bot called \Sources. I'll use C:\Bebot as an example so path would be C:\Bebot\Sources

Next move(don't copy) the following files to the \Sources folder from the Root bot folder:
MySQL.php
AOChat.php
Bot.php
and move ModuleSettings.php from the \core folder to \Sources also.

Now inside main.php find:
Code: [Select]
/*
Load the 3 basic modules:
MySQL: Used to communicate with the MySQL database
AOChat: Interface to communicate with AO chat servers
Bot: The actual bot itself.
*/
require_once "MySQL.php";
require_once "AOChat.php";
require_once "Bot.php";
Replace with:
Code: [Select]
/*
Load the 3 basic modules + Settings module first:
MySQL: Used to communicate with the MySQL database
AOChat: Interface to communicate with AO chat servers
Bot: The actual bot itself.
ModuleSettings: Settings Control for Bot functions.
*/
require_once "./Sources/MySQL.php";
require_once "./Sources/AOChat.php";
require_once "./Sources/Bot.php";
require_once "./Sources/ModuleSettings.php";
Save main.php and restart bot. If you placed all the files in the right place the Settings Module should load before Online.php
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: modified Online.php
« Reply #24 on: January 17, 2007, 06:43:06 am »
Sorry, I was testing a different approach while you were posting yours.  :) Am trying to get the bot to load the core and modules directories in alphbetical order. This is what I have come up with so far:
Code: [Select]
// Load up all core-modules
$folder = dir("./core/");
$modules = array();
while ($mod = $folder->read())
{
        if (!is_dir($mod) && !preg_match("/^_/", $mod) && preg_match("/php$/i", $mod))
        {
                array_push($modules, $mod);
        }
}
sort($modules);
foreach ($modules as $mod) {
        require_once "core/" . $mod;
        $bot -> log("CORE", "LOAD", $mod);
}


// Load up all modules
$modules = array();
$folder = dir("./modules/");
while ($mod = $folder->read())
{
        if (!is_dir($mod) && !preg_match("/^_/", $mod) && preg_match("/php$/i", $mod) && (($guildbot && !preg_match("/_RAID/", $mod)) || (!$guildbot && !preg_match("/_GUILD/", $mod))))
        {
                array_push($modules, $mod);
        }
}
sort($modules);
foreach ($modules as $mod) {
        require_once "modules/" . $mod;
        $bot -> log("MOD", "LOAD", $mod);
}

Since ModuleSettings.php comes before Online.php, this already solves my problem. But it would also make it possible to rename them to, say, 01ModuleSettings.php and 02Online.php. All this is ofc not a really nice way to deal with dependancies...
« Last Edit: January 17, 2007, 06:51:17 am by pusikas »
Luuv  Bot-Keeper of Vengeance ^^*

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: modified Online.php
« Reply #25 on: January 17, 2007, 06:50:54 am »
I'd personally go my way since that's the direction later versions will take. Not to mention less coding. :)
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: modified Online.php
« Reply #26 on: January 17, 2007, 06:52:29 am »
Ah, sources, core and modules is going to be standard? (we are thoroughly derailing this thread...)
My approach isn't really more code, I just posted a lot of context. And... as I said, none of these solutions are the perfect way to deal with dependancies. Would be cool to have something like the way that linux startup scripts in /etc/init.d work. Like, you can state for each module on which other modules it relies and the bot figures out in which order to load them itself. :)
« Last Edit: January 17, 2007, 06:58:07 am by pusikas »
Luuv  Bot-Keeper of Vengeance ^^*

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: modified Online.php
« Reply #27 on: January 17, 2007, 07:13:31 am »
OK, back to topic, I do not know if anyone else likes this, but I introduced a new setting to turn the guestchannel leave and join messages on and off.
The following belongs right below the almost identical code in function Online:
Code: [Select]
    if (!isset($this -> bot -> settings['Online']['pgspam']))
    {
        $module = "Online";
        $longdesc = "Show join/leave Privatgroup messages on GC";
        $this -> bot -> set -> create ($module, "pgspam", TRUE, $longdesc, "On;Off", FALSE, $disporder=2);
        unset($longdesc);
        unset($module);
    }

The following replaces the two functions with the same names:
Code: [Select]
    /*
    This gets called if someone joins the privgroup
    */
    function pgjoin($name)
    {
        $this -> pgroup[$name] = $this -> whois($name);
        if ($this -> bot -> settings['Online']['pgspam']) {
                $this -> bot -> send_gc($name ." has joined the guest channel");
        }
    }


    /*
    This gets called if someone leaves the privgroup
    */
    function pgleave($name)
    {
        if (isset($this -> pgroup[$name]))
                unset($this -> pgroup[$name]);
        if ($this -> bot -> settings['Online']['pgspam']) {
                $this -> bot -> send_gc($name ." has left the guest channel");
        }
    }
Luuv  Bot-Keeper of Vengeance ^^*

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: modified Online.php
« Reply #28 on: January 17, 2007, 08:08:47 am »
Does not work for me. The bot always loads Online.php first and exits with an error because it doesn't know the $this -> bot -> set -> create part in line 53. Works for the other modules you posted. These are in the modules directory, and Glara's settings module is already loaded by the time they are loaded. Is there a way to influence the order in which the core modules are loaded?

Also, kinda unrelated, my "users" complained about the many "has joined the guest channel" and "has left the guest channel" messages we often get during raids and orgmeetings. Took me a while to pinpoint the Online.php. I would have somehow expected that code to be in PrivGroup.php or so. :) Anyways, I removed that for me, but maybe a setting to turn the guestchannel announcements on and off would be cool. If someone gives me a hint on how to make Online.php run with the new settings, I can try to code that myself, too.

Yeah actually, the privgroup notifications should really be in the privgroup.php file I guess, it wasn't in the standard one and because I already had it in the online.php, I didn't add it to my modified privgroup module (which is the one I use).

On the loading of modules, mine loads in alphabetical order.  (Modulesettings then Online - obviously modulesettings should also be in the core directory).

The selector for displaying pgspam is a good idea :-)

-jj-

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: modified Online.php
« Reply #29 on: January 17, 2007, 08:34:25 am »
Compiled with all the fixes and switched to using Glara's new module settings plugin for the display type switch.  Also requires Alreadythere's persistant whois cache.

http://www.jjones.co.uk/files/online.php

-jj-

p.s. moved to the unofficial 0.2.x modules forum as most of the fixes didn't make it to SVN yet.

Applied setting to private group notifications as suggested by Pusikas.  Same link applies.

-jj-

 

* 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: 239
  • 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