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?
August 29, 2008, 08:53:52 PM

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 1201 times)
0 Members and 2 Guests are viewing this topic.
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1018


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: 1018


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
Freshman
*
Offline Offline

Gender: Male
Posts: 19


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: 1018


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
Freshman
*
Offline Offline

Gender: Male
Posts: 19


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: 1018


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
Freshman
*
Offline Offline

Gender: Male
Posts: 19


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
Dont get any TowerAttack ...
by Ziodberg
[Today at 06:15:35 PM]

Org Relaying
by Nytridr
[Today at 03:43:06 PM]

Auto reinvite not setting...
by Temar
[Today at 02:12:59 PM]

Link 2 Guilds via 2 Bots?
by Nytridr
[Today at 01:19:39 PM]

Question about Logon.php
by Temar
[Today at 07:17:13 AM]

MOTD module from 2.x to 4...
by Karsta
[Today at 04:14:55 AM]

Upcoming Channels
by Temar
[Today at 04:00:07 AM]

Reducing the load on a se...
by Alreadythere
[August 28, 2008, 03:29:35 PM]

Ported Modules
by krommel
[August 28, 2008, 12:01:19 PM]

Communication between gui...
by Temar
[August 27, 2008, 08:28:49 PM]
Stats
Members
Total Members: 949
Latest: pobo
Stats
Total Posts: 10356
Total Topics: 1406
Online Today: 20
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 2
Guests: 29
Total: 31
chamoul
Chakki

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.643 seconds with 28 queries. (Pretty URLs adds 0.027s, 4q)
Loading...