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 02, 2008, 08:00:13 AM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Official modules > Topic: Alternate Timer implementation
Pages: [1] 2   Go Down
« previous next »
Print
Author Topic: Alternate Timer implementation  (Read 1424 times)
0 Members and 1 Guest are viewing this topic.
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Alternate Timer implementation
« on: August 03, 2007, 12:31:58 PM »

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
« Last Edit: October 07, 2007, 07:14:56 AM by Alreadythere » Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #1 on: August 04, 2007, 11:31:05 AM »

Added support to relay timer, read first post.

Quote from: Alreadythere on August 03, 2007, 12: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.
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #2 on: August 04, 2007, 01:04:59 PM »

Added note about the need for the SVN version of the relay module.
Logged
Newsworthy
Rookie
**
Offline Offline

Posts: 27


Re: Alternate Timer implementation
« Reply #3 on: August 04, 2007, 08:50:58 PM »

Love the module, thanks for posting! Smiley

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 Smiley
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #4 on: August 05, 2007, 02:46:40 AM »

That was actually a "feature", the regexp didn't accept 0 as first letter for a duration. Changed, updated file in first post.
Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Alternate Timer implementation
« Reply #5 on: August 05, 2007, 07:39:36 AM »

Propose adding this to SVN trunk at the very least.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #6 on: August 05, 2007, 12:22:12 PM »

Added to 0.5 and 0.4 lines.
Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Alternate Timer implementation
« Reply #7 on: August 05, 2007, 07:25:48 PM »

Reminder for myself and Alreadythere.

Module missing help.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Parfet
Rookie
**
Offline Offline

Posts: 33


Re: Alternate Timer implementation
« Reply #8 on: August 05, 2007, 07:58:37 PM »

i made a start of help for this plugin myself, off the 1st(?) post, before the relay changes

Code:
$this -> help['description'] = 'Creates Timers.';
$this -> help['command']['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.";
$this -> help['command']['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.";
$this -> help['command']['timers']="- lists all current timer for the bot and offers support to delete them. " . ucfirst(strtolower($this -> bot -> settings -> get("Timer", "DeleteRank"))) . " can delete timers of other users, users can always delete their own timers or a timer of one of their registered alts.";

granted this is mostly cut&paste from the first post
Logged
Newsworthy
Rookie
**
Offline Offline

Posts: 27


Re: Alternate Timer implementation
« Reply #9 on: August 07, 2007, 12:15:29 AM »

Is there a way to reduce the amount of times it notifies you of the timer running out?

ie, removing the 10second counter, and having say, 5min, 1min, 30sec, end? Thanks Smiley
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #10 on: August 07, 2007, 03:42:00 AM »

Not yet, but it's on the list of things to add.
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #11 on: September 18, 2007, 03:33:16 PM »

Added functions to create timer classes as well as a LowSpam timer class, which notices less often about a running timer.

Edited the above links, they now always point to the most current version of the timer files in the 0.4 SVN branch.
Logged
Ziodberg
Freshman
*
Offline Offline

Posts: 10


Re: Alternate Timer implementation
« Reply #12 on: September 19, 2007, 06:31:59 PM »

This ist not as it was intended, or is it?

[Carpe Noctem] Jalajala: !timer 30 bla
[Carpe Noctem] Aidbot: Teemer ##heeghleeght##bla eend##veet ##heeghleeght#eend##roonteeme-a sterted!
Bork Bork Bork!

I get the same kind of reply when i use !memberlist
« Last Edit: September 19, 2007, 06:34:21 PM by Ziodberg » Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #13 on: September 24, 2007, 09:10:28 AM »

Kill the string filter you are running, that will solve the problem for the moment.

It'll need a slight internal rework to do all replacement work before using the string filter, that's what's braking the bot right now.
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Alternate Timer implementation
« Reply #14 on: September 24, 2007, 09:27:29 AM »

Fixed the core module to update the class cache for timer classes each time after a new entry is created. Otherwise the module wouldn't have any clue what to do with new classes till the next cache update.
Logged
Pages: [1] 2   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Official modules > Topic: Alternate Timer implementation
« previous next »
 
Jump to:  

Recent
Log playtime from buddys ...
by IKShadow
[Today at 06:48:12 AM]

[request] Raid timers
by Elesar1
[December 01, 2008, 04:41:09 PM]

Shared DB online list
by Temar
[December 01, 2008, 01:55:47 AM]

relay colors
by Temar
[December 01, 2008, 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]
Stats
Members
Total Members: 1243
Latest: Whackoeng
Stats
Total Posts: 11145
Total Topics: 1505
Online Today: 15
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 4
Guests: 19
Total: 23
gerborg
Temar
Wolfbiter

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.33 seconds with 29 queries. (Pretty URLs adds 0.029s, 4q)
Loading...