I need a script that will display, on a public !command, how many hours:mins:secs is left until a specified time. In this case 12:00. However, I need to deduct 1 hour from my time to cover the timezone difference before announcing time before midnight. But I am confused as to what I actually need to use to do this. I was looking at this thread: http://forum.egghelp.org/viewtopic.php? ... light=zone which is where I learned about clock scan/seconds, but I am unsure of how to use these to do what I need.
This is what i have so far. Have not tested it, as I am not sure I even did the bind properly:
bind pub * !time time:left
proc time:left {nick host hand chan} {
set tartime [clock scan "00:00:00"]
set mytime [clock scan "%T"
set offset [duration [expr $mytime - 3600]] ; #I assume I would subtract an hour by seconds
set difftime [duration [expr $offset - $tartime]
if {$offset != $tartime} {
putserv "PRIVMSG $nick :Time left until midnight is $difftime"
}
}
bind pub * !time time:left
proc time:left {nick host hand chan text} {
set tartime [clock scan "00:00:00"]
set mytime [clock scan "%T"]
set offset [duration [expr {$mytime - 3600}]]
set difftime [duration [expr {$offset - $tartime}]]
if {$offset != $tartime} {
putserv "PRIVMSG $nick :Time left until tomorrow is $difftime"
}
}
But I get an error in partyline when I load the command "Tcl error [time:left]: unable to convert date-time string "%T": syntax error (characters 0-0)"