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?
September 08, 2008, 01:10:26 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 1231 times)
0 Members and 1 Guest are viewing this topic.
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1024


Re: Alternate Timer implementation
« Reply #15 on: October 03, 2007, 05:27:22 AM »

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:
$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");
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1024


Re: Alternate Timer implementation
« Reply #16 on: October 07, 2007, 07:17:53 AM »

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, 07:20:37 AM by Alreadythere » Logged
Trancillion
Rookie
**
Offline Offline

Gender: Male
Posts: 20


Re: Alternate Timer implementation
« Reply #17 on: October 07, 2007, 12: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.
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1024


Re: Alternate Timer implementation
« Reply #18 on: October 07, 2007, 01: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?
Logged
Trancillion
Rookie
**
Offline Offline

Gender: Male
Posts: 20


Re: Alternate Timer implementation
« Reply #19 on: October 08, 2007, 01: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.
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1024


Re: Alternate Timer implementation
« Reply #20 on: October 09, 2007, 06:30:37 AM »

Did this happen once only? Or is it happening regulary?
Logged
Trancillion
Rookie
**
Offline Offline

Gender: Male
Posts: 20


Re: Alternate Timer implementation
« Reply #21 on: October 09, 2007, 02: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.
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
BeBot v0.5.3 released (de...
by Temar
[Today at 12:32:25 AM]

Help with online info in ...
by Barlyman
[September 07, 2008, 07:56:24 PM]

Security
by Alreadythere
[September 06, 2008, 10:02:42 AM]

Probs with relay from gue...
by Temar
[September 06, 2008, 09:03:06 AM]

Raid spam in guild chat
by Temar
[September 06, 2008, 09:01:18 AM]

Org Relaying
by Nytridr
[September 06, 2008, 01:34:35 AM]

Link 2 Guilds via 2 Bots?
by Temar
[September 05, 2008, 04:22:40 PM]

SVN download
by clashbot
[September 05, 2008, 05:12:59 AM]

TWC
by Temar
[September 05, 2008, 12:27:23 AM]

How to find the guild ID?...
by Irinir
[September 03, 2008, 02:58:54 PM]
Stats
Members
Total Members: 965
Latest: morisey
Stats
Total Posts: 10416
Total Topics: 1413
Online Today: 10
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 3
Guests: 24
Total: 27
Wolfbiter
Temar
kaagee

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.195 seconds with 28 queries. (Pretty URLs adds 0.035s, 4q)
Loading...