Archive > AO official modules

Alternate Timer implementation

(1/5) > >>

Alreadythere:
I've rewritten my (never published) timer module for bebot, as that one did permanent SQL spam.

The module  saves timers in a table, supports notifies via timer classes (though there is no way to define any own classes besides the standard one yet, it's on my list of things to add) and it queries the SQL table only if any event (either timer finished or notification needed) is happening.

The implementation consists of two modules atm, one core module handling the backend stuff and offering functions to other modules to add and delete timer, and one GUI module handling all user interactions.

The module supports relaying timers to other bots using an existing relay. You need to setup a relay using the Relay_GUILD.php module. Then load the TimerRelay.php module from the link below, and enable the setting Relay of the timer module. All done.

Commands:

* !timer #[mshd] title adds a timer for # minutes (m), seconds (s), hours (h) or days (d). If no time unit is added it's # seconds.
* !timer #[:##[:##[:##]]] title adds a timer using the format days:hours:minutes:seconds, with the lowest time unit always being seconds (so 1:20 means 1min 20secs, 1:03:05 means 1hour 3mins 5secs). On every : there have to follow exactly two numbers.
* !timers lists all current timer for the bot and offers support to delete them. There is a setting to define the minimum level which can delete timers of other users, users can always delete their own timers or a timer of one of their registered alts.
Core module, save as .php in your core folder.
GUI module, save as .php in your modules folder.
Relay module, save as .php in your modules folder.

Bot core, save as .php in your Sources folder.

Note: You'll need the most current version of the relay module from the SVN for the relaying to work. Get it here, save as .php into the modules folder again.

Things on my TODO:

* extend the support for timer classes
* add pre-definable timers for fixed events

Alreadythere:
Added support to relay timer, read first post.


--- Quote from: Alreadythere on August 03, 2007, 07:31:58 pm ---The module supports relaying timers to other bots using an existing relay. You need to setup a relay using the Relay_GUILD.php module. Then load the TimerRelay.php module from the link below, and enable the setting Relay of the timer module. All done.
--- End quote ---

Alreadythere:
Added note about the need for the SVN version of the relay module.

Newsworthy:
Love the module, thanks for posting! :)

Just one error I found, adding a timer via /tell, it doesn't like the format Mins:Secs. Only accepts when posted without the :

Example:

To [Scnet]: !timer 300 TEST
[Scnet]: Timer TEST with 00:05:00 runtime started!
To [Scnet]: !timer 01:00 TEST
Nothing happens.

Thanks :)

Alreadythere:
That was actually a "feature", the regexp didn't accept 0 as first letter for a duration. Changed, updated file in first post.

Navigation

[0] Message Index

[#] Next page

Go to full version