collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Alternate Timer implementation  (Read 29825 times)

0 Members and 2 Guests are viewing this topic.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Alternate Timer implementation
« on: August 03, 2007, 07: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, 02:14:56 pm by Alreadythere »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #1 on: August 04, 2007, 06:31:05 pm »
Added support to relay timer, read first post.

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.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #2 on: August 04, 2007, 08:04:59 pm »
Added note about the need for the SVN version of the relay module.

Offline Newsworthy

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #3 on: August 05, 2007, 03:50:58 am »
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 :)

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #4 on: August 05, 2007, 09: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.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Alternate Timer implementation
« Reply #5 on: August 05, 2007, 02:39:36 pm »
Propose adding this to SVN trunk at the very least.
BeBot Founder and Fixer Kingpin

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #6 on: August 05, 2007, 07:22:12 pm »
Added to 0.5 and 0.4 lines.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Alternate Timer implementation
« Reply #7 on: August 06, 2007, 02:25:48 am »
Reminder for myself and Alreadythere.

Module missing help.
BeBot Founder and Fixer Kingpin

Offline Parfet

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #8 on: August 06, 2007, 02:58:37 am »
i made a start of help for this plugin myself, off the 1st(?) post, before the relay changes

Code: [Select]
$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

Offline Newsworthy

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #9 on: August 07, 2007, 07: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 :)

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #10 on: August 07, 2007, 10:42:00 am »
Not yet, but it's on the list of things to add.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #11 on: September 18, 2007, 10: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.

Offline Ziodberg

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #12 on: September 20, 2007, 01:31:59 am »
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 20, 2007, 01:34:21 am by Ziodberg »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #13 on: September 24, 2007, 04:10:28 pm »
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.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #14 on: September 24, 2007, 04:27:29 pm »
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.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


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 ]

* Who's Online
  • Dot Guests: 199
  • 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