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?
November 21, 2008, 10:31:34 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 > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Custom Timers
Pages: [1] 2 3   Go Down
« previous next »
Print
Author Topic: Custom Timers  (Read 3702 times)
0 Members and 1 Guest are viewing this topic.
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Custom Timers
« on: November 27, 2005, 05:54:44 PM »

This will add the commands !timer and !timers to your bot.

You can set a timer by using "!timer 0:5:0 Test" to add a 5 minutes timer and so on.

The script will notify the chat group every 2/1 hours, and 30/15/5 minutes before timer expires.

Also you can use "!timer <ID>" to check remaining time.
« Last Edit: January 24, 2006, 04:33:18 PM by Wanuarmi » Logged
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Custom Timers
« Reply #1 on: November 27, 2005, 05:55:33 PM »

help/timer.txt
help/timers.txt

Code:
<font color=CCInfoHeader><pre>timer | <pre>timers</font>
<font color=CCInfoText>Shows current timers.

<font color=CCInfoHeader><pre>timer &lt;HH:MM:SS&gt; &lt;description&gt;</font>
<font color=CCInfoText>Sets a timer. The timer will be announced 1 hour, 30 minutes, 15 minutes and 5 minutes before it ends.

<font color=CCInfoHeader><pre>timer del &lt;ID&gt;</font>
<font color=CCInfoText>Deletes a timer. Use the ID from the timers list.
« Last Edit: December 14, 2005, 06:07:15 PM by Wanuarmi » Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Custom Timers
« Reply #2 on: November 27, 2005, 05:57:18 PM »

Nice one. Will play with it later Smiley
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Custom Timers
« Reply #3 on: December 06, 2005, 10:43:32 PM »

This module is screwed. If there's no Timers in the DB it spams the console with:
Warning: Invalid argument supplied for foreach() in \Bebot\modules\CustomTimers.php on line 69

Also gives the same warning at start up but on line 164.

Suggest you test for Timer entries before you process those code pieces.
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Custom Timers
« Reply #4 on: December 07, 2005, 02:52:59 AM »

try placing

Code:


if (!empty($this -> timers)) {


}



around those foreach statements, my php doesnt show warnings

I wonder if anyone else is using this, I used it for about two weeks before posting, and so far I havent had problems with it

btw thanks khalem Smiley tell me if you guys find other problems with it

im not updating it to fix warnings unless thats the way most windows users have php setted for
Logged
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Custom Timers
« Reply #5 on: December 07, 2005, 03:22:37 AM »

The Default for PHP.exe CLI is to show all warnings. Since most Windows users use the very minimal php.ini that comes with the Bot, it's best just to clean the code up so the Warnings don't happen... least the log fills up with a Warning for each time the cron job runs.

I had already placed those if() statements in the copy I'm running btw just so php wasn't spamming the hell out of the php window on my server.
Just wanted you to know it was broken if used as is. The same warnings would appear on Linux/Unix machines also, but I think most users of Linux use a global php.ini that has Warnings like that turned off.
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Re: Custom Timers
« Reply #6 on: December 14, 2005, 06:11:11 PM »

updated, fixed xenixa's bug and did some minor tweakings so the code looks better
« Last Edit: December 14, 2005, 06:12:55 PM by Wanuarmi » Logged
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Re: Custom Timers
« Reply #7 on: January 09, 2006, 02:55:56 PM »

updated, added command !timer <ID> that will show how much time until expiration
Logged
jokerjr
Freshman
*
Offline Offline

Posts: 12


Re: Custom Timers
« Reply #8 on: January 12, 2006, 07:06:36 PM »

I use this module a lot thanks I love it.
Logged
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Re: Custom Timers
« Reply #9 on: January 24, 2006, 04:29:47 PM »

thanks man, I appreciate it Smiley

updated, fixed a bug with dates, using gmdate() now instead of date()
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Custom Timers
« Reply #10 on: February 06, 2006, 07:46:34 PM »

Hm, tried it on my bot and the time is 6 hours off.

My timezone is set to GMT -6...
Logged
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Re: Custom Timers
« Reply #11 on: February 07, 2006, 11:50:38 AM »

this module uses GMT 0, for it to work on your timezone you would need to change all gmdate() for date() and gmmktime() for mktime()
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Custom Timers
« Reply #12 on: February 07, 2006, 06:17:21 PM »

My point is the way you've coded it isn't time zone neutral. I had similar issues when working on my spawn time guesstimator, who would have thought a simple thing like time could have gotten so confusing? Smiley

The problem is gmmktime() assumes you are passing a GMT timestamp, and using just gmmktime() is fine if your system clock is set to GMT. If however you're system's clock is set to the local time zone, it seems you actually get local time, not GMT. The documentation leads me to believe that you should be getting a GMT timestamp, but in practice gmmktime() is giving me local time.

Using time() would be the correct method as time() always returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT), and hence will always be GMT time no matter what the system time zone is set to.

So in the end, the correct fix is to continue using gmdate(), but use time() instead of gmmktime(). I made this change on my bot and it works fine, and it should work no matter what my time zone the system is using.

(And please feel free to correct me if I've interpreted the PHP documentation incorrectly!)

* Although civil time, e.g., the Greenwich Time Signal in Great Britain, is now based on UTC, it is still popularly called GMT. See UTC and GMT at Wikipedia. Smiley
Logged
Wanuarmi
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 121


Re: Custom Timers
« Reply #13 on: February 07, 2006, 09:09:59 PM »

I hate php date functions, I always lose time with them trying to get them right. You seem to be right with the time() function, though times are right on my bot and my server's local time isnt gmt. Ill check this out better later.
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Custom Timers
« Reply #14 on: February 08, 2006, 04:01:21 PM »

Quote from: Wanuarmi on February 07, 2006, 09:09:59 PM
I hate php date functions, I always lose time with them trying to get them right.

I totally agree.  Grin
Logged
Pages: [1] 2 3   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Custom Timers
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[Today at 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 17
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 1
Guests: 19
Total: 20
Elesar1

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