BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Module Requests => Topic started by: Nytridr on January 25, 2008, 02:16:26 pm
-
Would love to be able to set a timer that will restart itself when ever it ends for towers.
maybe something like
!towers 25 9:34:81 Discription
This would count down and like an hour before that site goes hot it would say something in org chat or in the raid bot. and when it goes to 25% it would tell ya then also. Then it would continue on till like an hour before 5% and then spam chat, then when it changes to 5% it would also say something. and back to 75% and keep going in a circle until you delete the timer.
Not sure if it could read in from aochat if the tower was taken or not but that would be a nice feature also. Would automatically delete the timer if the base was lost.
-
Should be fairly easy to do using timed events - that way you can react to the notifies and ends of timers yourself. The module would just have to cover bot downtimes in some way...
-
The module would just have to cover bot downtimes in some way...
My APF module does this by using a seed time and an interval. The seed time is a known occurrence of the event. From there, the interval is added until the bot sees that nextime >= time().
I repeating timer that persisted through bot restarts would be similar.
!retimer <remaining> <interval> <description>
<remaining>: Time remaining until the next occurrence.
<interval>: Interval for repetition.
<description>: Description of the event.
Store time()+<remaining> in the database (as well as <interval> and <description>) and you can calculate your timer indefinitely. Computers can do simple math quickly enough so you wouldn't necessarily have to update the seed time.
-
Attached is an outdated rtimer module, if anyone would kindly update it then im sure this is exactly what the OP was looking for [and me as well ;D]
-
Added to the list of TODOs for the module mentioned in http://bebot.link/module-requests/personal-org-tower-info-tool/msg8617
-
I was just hoping for a standalone rtimer for keeping track of 18 hour dynas hehe.
That's a nice idea to add it to the neat tower tracking module you're working on, though :o
-
Repeated timer are on my todo list for the timer core. Though they've been there for quite a time now.
-
!rtimer implemented.
For the 0.4 branch use the files below, for SVN best do an svn update.
Timer Core (http://svn.shadow-realm.org/index.py/BeBot/branches/0.4/core/Timer_Core.php?view=co), save as core/Timer_Core.php
TimerGUI (http://svn.shadow-realm.org/index.py/BeBot/branches/0.4/modules/TimerGUI.php?view=co), save as modules/TimerGUI.php
-
Fatal error: Call to undefined method Bot::core() in C:\...\modules\TimerGUI.php on line 181
v0.4.3
-
And here I was sure I converted all those...
Removed the core() calls, simply redownload from above link.
-
Changed
elseif (preg_match("/^" . $this -> bot -> commpre . "rtimer ([a-z]+ )?([1-9][0-9]*[mshd]?) ([1-9][0-9]*[mshd]?) (.*)/i", $msg, $info))
{
return $this -> add_timer($name, $info[2], $info[4], $info[1], $info[3], $channel);
}
elseif (preg_match("/^" . $this -> bot -> commpre . "rtimer ([a-z]+ )?([0-9]+(:[0-9][0-9]){0,3}) ([0-9]+(:[0-9][0-9]){0,3}) (.*)/i", $msg, $info))
{
return $this -> add_timer($name, $info[2], $info[6], $info[1], $info[4], $channel);
}
to
elseif (preg_match("/^" . $this -> bot -> commpre . "rtimer ([a-z]+ )?([1-9][0-9]*[mshd]?) ([1-9][0-9]*[mshd]?) (.*)/i", $msg, $info))
{
$this -> bot -> send_output($name, $this -> add_timer($name, $info[2], $info[4], $info[1], $info[3], $channel), $channel);
}
elseif (preg_match("/^" . $this -> bot -> commpre . "rtimer ([a-z]+ )?([0-9]+(:[0-9][0-9]){0,3}) ([0-9]+(:[0-9][0-9]){0,3}) (.*)/i", $msg,
$info))
{
$this -> bot -> send_output($name, $this -> add_timer($name, $info[2], $info[6], $info[1], $info[4], $channel), $channel);
}
Which I think is what you intended [to notify that a timer was created], and also added a help info for rtimer
$this -> help['command']['rtimer initial#[mshd] interval#[mshd] title']="Adds a timer that starts in initial # minutes (m), seconds (s), hours (h) or days (d), and is repeated every interval # minutes (m), seconds (s), hours (h) or days (d). If no time unit is added it's # seconds.";
$this -> help['command']['rtimer initial#[:##[:##[:##]]] interval#[:##[:##[:##]]] title']="Adds a timer that starts in initial time, and is repeated every interval time, 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. You don't have to enter all numbers.";
Attached in TimerGUI.phps.
Thanks for the quick coding work Alreadythere, but one thing still odd I noticed. After the intitial timer is set, ones that follow on the interval dont give the "Timer X has one minute left, name!, Timer X has 30 seconds left, name!" etc - it just gives Timer X has finished, name!
-
Thanks for those fixes, missed them when I backported from trunk.
Redownload the Timer_Core.php linked above please, I think I fixed the notification problem. Was another backporting bug.