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.

Countdown problem

Help for those learning Tcl or writing their own scripts.
Post Reply
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Countdown problem

Post by stalix »

set date "October 22 14:00:00 2000"
set msj "have passed with McLaren being losers"

bind pub - !mcloser pub:mcloser
proc pub:mcloser {nick uhost hand chan text} {
global date msj
set dur [expr [clock scan $date]-[clock seconds]]
putquick "PRIVMSG $chan : [duration $dur] $msj"
}

<bot> 0 seconds have passed with McLaren being losers

How can fix them? THANKS!
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

[clock seconds] is recent while $date is very old, so you're doing it vise-versa. Replace

Code: Select all

set dur [expr [clock scan $date]-[clock seconds]]
with

Code: Select all

set dur [expr {[clock seconds] - [clock scan $date]}]
Post Reply