I made this TCL script with 0-hour experience. It works just the way i want but there is couple of mystery things. This is very RAW-code, cause all is hard coded directly to script, but it isn't problem to me.
Problems with this is, that it doesn't update topic only at 00:03. Today topic has changed today 3 times. First 00:03 then 00:06 and latest 07:07.
Second weird thing is that, when topic have changed at 00:03 and 00:06, ONLY diff1 has updated to topic. Other numbers are wrong, they haven't updated. But when today 07:07 script (For some reason?) has again changed topic, then all days was correct.
Can anyone explain what causes those things, cause i don't have any idea.
Code: Select all
bind time - "03 00 * * *" time:topic
proc time:topic { min hour day month year } {
##Far Cry 2 Release date
set date1 [clock scan "2008-10-21"]
##Red Alert 3, Fallout 3 Release date
set date2 [clock scan "2008-10-28"]
##Call of Duty: World at War Release date
set date3 [clock scan "2008-11-11"]
##Grand Theft Auto IV (GTA 4) Release date
set date4 [clock scan "2008-11-18"]
##Date now
set now [clock seconds]
set diff1 [expr {(($date1 - $now)/60/60/24)+1}]
set diff2 [expr {(($date2 - $now)/60/60/24)+1}]
set diff3 [expr {(($date3 - $now)/60/60/24)+1}]
set diff4 [expr {(($date4 - $now)/60/60/24)+1}]
puthelp "TOPIC #my_channel :Far Cry 2 ($diff1 days) | Red Alert 3 ($diff2 days) | Fallout 3 ($diff2 days) | CoD: World at War ($diff3 days) | GTA IV ($diff4 days) | NFS: Undercover ($diff4 days)"
}
putlog "Topic countdown by me"