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

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

Author Topic: Alternate Timer implementation  (Read 11645 times)

0 Members and 2 Guests are viewing this topic.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #15 on: October 03, 2007, 12:27:22 pm »
Added timer class as optional first parameter to !timer calls.

!timer lowspam 15m title will create a timer using the lowspam class, !timer 15m title will create a timer using the default class (whichever that is).

Just grab TimerGUI.php again.

The code below will create a timer class with only two notices at 5min and 10min till timer runs out. Use this and the definitions in Timer_Core.php, the city module and the orbital module as bases for any custom timer classes you want to create. Read up on the explanation on top of the Timer_Core.php too.
Code: [Select]
$classid = $this -> create_timer_class("AlmostNoSpam", "Timer class that only spams at 5 and 10mins left.");
$nextid = $this -> create_timer_class_entry($classid, -1, 300, "Timer", "has five minutes left");
$nextid = $this -> create_timer_class_entry($classid, $nextid, 600, "Timer", "has ten minutes left");

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #16 on: October 07, 2007, 02:17:53 pm »
Added support for timed events. This way a module can register itself to the timer core for callbacks, and then use the add_timer() function to get the registered callback function called at a specific time. All that needs to be done in addition to the registering and the adding of the timer is the implementation of a timer() function in the module. For more information how to use this feature read the comment at the top of the core/Timer_Core.php file.

This is supposed to be an extension to the existing cron system. For repeating events use the current cron system, for events that only happen once or once in a while, perhaps even without a fixed duration between two events, it may be better to use the timer system instead of registering and unregistering a cron job and perhaps doing your own time calculation in there.

I changed the hooking of timers into the cron system, so for the most current version in the 0.4 branch to work at all you'll have to update your Bot.php too this time. I added a link to the most current version in the SVN in the first post.
« Last Edit: October 07, 2007, 02:20:37 pm by Alreadythere »

Offline Trancillion

  • BeBot User
  • **
  • Posts: 20
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #17 on: October 07, 2007, 07:45:53 pm »
Seems like i have a problem with the timer :s whole minutes goes fine ut if i use for example 29:45 then it don't want to tell me the normale time it uoly tells it's 10 min left etc, any ides ? just me and my guild mates that has this problem with it ?

To [Noctrish]: !timer 20:00 Comatosed Soul
[Noctrish]: Timer Comatosed Soul with 00:20:00 runtime started!
[Noctrish]: Timer Comatosed Soul has 10 minutes left!
[Noctrish]: Timer Comatosed Soul has 5 minutes left!
[Noctrish]: Timer Comatosed Soul has two minutes left!
To [Noctrish]: !timer 29:45 mhm
[Noctrish]: Timer mhm with 00:29:45 runtime started!
[Noctrish]: Timer Comatosed Soul has one minute left!
[Noctrish]: Timer Comatosed Soul has 30 seconds left!
[Noctrish]: Timer Comatosed Soul has 10 seconds left!
[Noctrish]: Timer Comatosed Soul has finished!
[Noctrish]: Timer mhm has 20 minutes left!
[Noctrish]: Rotta!mhm!

the end line "Rotta!mhm!"  Rotta was one of my team mates timer that had the same problem as mhm.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #18 on: October 07, 2007, 08:02:28 pm »
I'm not quite clear what the error is, or how to reproduce it. I did some testing with timers in the format X:YZ, and they worked as expected.

And what do you mean with it don't want to tell me the normale time it uoly tells it's 10 min left etc?

Offline Trancillion

  • BeBot User
  • **
  • Posts: 20
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #19 on: October 08, 2007, 08:40:46 am »
To [Noctrish]: !timer 29:45 mhm
[Noctrish]: Timer mhm with 00:29:45 runtime started!
[Noctrish]: Timer mhm has 20 minutes left!
[Noctrish]: Rotta!mhm!

is what i meant. it only tells when it' 20 min left, and the Small notice when it's over.

It should tell when it's 20min 10min 5min 2min 1min 30sec 10sec and give a finish message no?

if it help you and you want to try and find out the error, i can give you access to both database and the bot files.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #20 on: October 09, 2007, 01:30:37 pm »
Did this happen once only? Or is it happening regulary?

Offline Trancillion

  • BeBot User
  • **
  • Posts: 20
  • Karma: +0/-0
Re: Alternate Timer implementation
« Reply #21 on: October 09, 2007, 09:37:32 pm »
from what my firend tells me it happens with every timer that is over 20min. I haven't had the time myselfe yet to check that out, tho he uses the !timer command alot pr day.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

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