L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2008, 12:36:38 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: modified Online.php
Pages: 1 [2] 3   Go Down
« previous next »
Print
Author Topic: modified Online.php  (Read 3884 times)
0 Members and 1 Guest are viewing this topic.
MatHack
Guest
Re: modified Online.php
« Reply #15 on: March 15, 2006, 09:57:06 AM »

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:
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]);
}
Logged
Naturalistic
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 221


Re: modified Online.php
« Reply #16 on: March 15, 2006, 11:12:43 AM »

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 Tongue
Logged

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, 11:16:27 AM »

Yeah, I did all that too, but they still show up on the online-list Wink

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
Logged
Naturalistic
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 221


Re: modified Online.php
« Reply #18 on: March 15, 2006, 11:19:08 AM »

Ah, good point.

I'll have to check it later, maybe I did something to the online list as well, not sure.
Logged

220/25 Eternalist Doctor
-----------------------------
Campalot Coding Co-ordinator and Super Admin
http://www.campalot.info/index.php
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Re: modified Online.php
« Reply #19 on: March 24, 2006, 07:08:22 AM »

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?"  Tongue

Good fix, should be added to SVN copy of Online.php *hint hint, wink wink, nudge nudge*.
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: modified Online.php
« Reply #20 on: January 16, 2007, 07:38:29 PM »

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 16, 2007, 07:42:43 PM by jjones666 » Logged
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: modified Online.php
« Reply #21 on: January 17, 2007, 12: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. Smiley 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, 12:08:54 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Re: modified Online.php
« Reply #22 on: January 17, 2007, 12: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. Smiley It'll still load and work from there.
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Re: modified Online.php
« Reply #23 on: January 17, 2007, 12: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:
/*
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:
/*
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
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: modified Online.php
« Reply #24 on: January 17, 2007, 12:43:06 AM »

Sorry, I was testing a different approach while you were posting yours.  Smiley 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:
// 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, 12:51:17 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Re: modified Online.php
« Reply #25 on: January 17, 2007, 12:50:54 AM »

I'd personally go my way since that's the direction later versions will take. Not to mention less coding. Smiley
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: modified Online.php
« Reply #26 on: January 17, 2007, 12: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. Smiley
« Last Edit: January 17, 2007, 12:58:07 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: modified Online.php
« Reply #27 on: January 17, 2007, 01: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:
    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:
    /*
    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");
        }
    }
Logged

Luuv  Bot-Keeper of Vengeance ^^*
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: modified Online.php
« Reply #28 on: January 17, 2007, 02:08:47 AM »

Quote from: pusikas on January 17, 2007, 12: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. Smiley 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-
Logged
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: modified Online.php
« Reply #29 on: January 17, 2007, 02:34:25 AM »

Quote from: jjones666 on January 16, 2007, 07:38:29 PM
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-
Logged
Pages: 1 [2] 3   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: modified Online.php
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[November 21, 2008, 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 18
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 2
Guests: 20
Total: 22
xlDanek
Temar

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.413 seconds with 29 queries. (Pretty URLs adds 0.048s, 4q)
Loading...