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?
December 01, 2008, 12:54:09 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Feedback and Suggestions > Topic: Custom Function Library
Pages: [1]   Go Down
« previous next »
Print
Author Topic: Custom Function Library  (Read 389 times)
0 Members and 1 Guest are viewing this topic.
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Custom Function Library
« on: September 26, 2006, 02:49:24 PM »

Experience seems to show that development of the official BeBot is likely to lag behind what module creaters are going to come up with. So to better support module coders, I think there should be a "official" place to store functions that can be used by mutiple modules.

The idea is that the distributed BeBot (.zip, .tar.gz, svn, etc.) should never contain a lib-custom.php. The bot should create the lib-custom.php below if it doesn't exisit, but if lib-custom.php already exisits nothing should ever happen to it.

Code:
<?
// lib-custom.php - Custom Functions.
$custom = new Custom($bot);
$bot -> custom = &$custom;
// The Class itself...
class Custom
{ // Start Class
var $bot;

// Constructor: Hands over a referance to the "Bot" class.
function Custom (&$bot)
{
$this -> bot = &$bot;
}

// Custom Functions Below this line.

} // End of Class
?>

Module developers can add functions they reuse often in their modules to lib-custom.php and call them like: $this -> bot -> custom -> functionname(); When a module is announced, the author would included "add this to lib-custom.php."

A good function may make it's way from lib-custom.php to an official BeBot core module in the next stable release.


Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Custom Function Library
« Reply #1 on: September 27, 2006, 03:10:13 PM »

Would it not be simpler to just provide the $bot -> custom and then have custom core modules merely hook into it by doing
Code:
$somecustom = new SomeCustom($bot);
$bot -> custom -> somecustom = &$somecustom($bot);

I don't see monolithic custom functions file as much of an improvement over todays situation of modifying Bot.php directly aside from the fact of avoiding having to reapply changes, and in any case i think separate files would be a better option while still allowing the modules to be called trough bot -> custom ->
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Naturalistic
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 221


Re: Custom Function Library
« Reply #2 on: September 27, 2006, 03:22:48 PM »

Khalem: he likes to make things more complicating than they already are Tongue
Logged

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

Posts: 414



Re: Custom Function Library
« Reply #3 on: September 27, 2006, 03:23:31 PM »

I take no responsiblity for the crap that falls out of my mind when I'm short on sleep.

Unless it's one of those rare gems. Those I'll take credit for.  Grin
Logged
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Feedback and Suggestions > Topic: Custom Function Library
« previous next »
 
Jump to:  

Recent
[request] Raid timers
by Alreadythere
[Today at 11:42:32 AM]

Shared DB online list
by Temar
[Today at 01:55:47 AM]

relay colors
by Temar
[Today at 01:54:56 AM]

BeBot v0.6.0 released
by Alreadythere
[November 30, 2008, 05:32:00 PM]

Change to Bid.php
by Temar
[November 30, 2008, 11:41:44 AM]

OnlineOrg
by Jiheld
[November 29, 2008, 12:44:27 PM]

Silly Newbie Question.
by Temar
[November 29, 2008, 12:00:02 PM]

massive_pvp_time_table 1
by gerborg
[November 29, 2008, 06:55:35 AM]

Bot not see Guild Chat
by Delvar
[November 28, 2008, 08:30:34 AM]

Starting Bot
by Allisande
[November 28, 2008, 07:08:21 AM]
Stats
Members
Total Members: 1243
Latest: Whackoeng
Stats
Total Posts: 11143
Total Topics: 1505
Online Today: 21
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 3
Guests: 13
Total: 16
egrath
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.509 seconds with 28 queries. (Pretty URLs adds 0.032s, 4q)
Loading...