This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

timer - does not give exact results (1minute approx 45 secs)

Old posts that have not been replied to for several years.
Locked
S
SIYB
Voice
Posts: 13
Joined: Sun Dec 19, 2004 5:45 pm

timer - does not give exact results (1minute approx 45 secs)

Post by SIYB »

when i tested the pizzatimer i am working on atm i came across something strange: when i set the timer to 1 minute eggdrop will execute the command after 40something seconds. is that normal? how do i change it if it isn't?

siyb
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: timer - does not give exact results (1minute approx 45 s

Post by egghead »

Can you provide us the code snippet you are looking at?
S
SIYB
Voice
Posts: 13
Joined: Sun Dec 19, 2004 5:45 pm

Post by SIYB »

bind pub - ${comchar}${xtimercom1} xtimer
##proc:xtimer##
proc xtimer {nick host hand chan text} {
set text [split $text " "]
set xtda [lindex $text 0]
set xtmsg [lindex $text 1]
set tmsg "$xtmsg"
set minutes "$xtda"
timer $minutes [list puthelp "PRIVMSG $nick :\0034TIMERARLARM!!!: \0030$xtmsg ist fertig!"]
putquick "PRIVMSG $nick :Dein Timer für \"$xtmsg\" wurde auf $minutes Minuten gestellt. Ich werde dir rechtzeitig bescheid geben."
putlog "xtimer set by $nick on $chan"
}


that's it, thx for your help.

siyb
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

the documentation is missleading, timer triggers on every 0 seconds time, so timer 1 COULD be just 1 sec, but it can be 59 sec, too. But however it will always be < 1 minute. So for small timers (<= 5min) I suggest using utimers.

PS: the same goes for utimer as well, it triggers on 0 millisec of each second. So using utimer 1 is no accurate way to trigger something exact 1 sec later, for more than ~2sec it will probably be meaningless :D.

PPS: the execution can of course be delayed due other blocking procs!
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
S
SIYB
Voice
Posts: 13
Joined: Sun Dec 19, 2004 5:45 pm

Post by SIYB »

hmm but if i use utimers, user will have to define their time in seconds won't they? that might be confusing (some users would even bother to try). hmm is there a way to create a list which follows a mathematical pattern (like excel),
so that i could make the bot recalculate all times given to him in <minutes> to <seconds>.

something like:
1m = 60s
1m = X
X * <minutes> = Y

i know that i probably would have to use: expr and/or incr , but i have never done it before...so is it possible to set equations like this with tcl?

siyb
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

Post by pollar »

Code: Select all

set seconds [expr $minutes * 60]

Code: Select all

utimer [expr $minutes * 60] [list puthelp "PRIVMSG $nick :\0034TIMERARLARM!!!: \0030$xtmsg ist fertig!"] 
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

!trigger [somethingbad] happens if you use that fix
photon?
Locked