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.
Old posts that have not been replied to for several years.
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Thu Mar 10, 2005 9:27 am
got it to work with help from someone else
Code: Select all
proc countdown {seconds} {
set minutes [expr $seconds / 60]
set seconds [expr $seconds % 60]
set hours [expr $minutes / 60]
set minutes [expr $minutes % 60]
set days [expr $hours / 24]
set hours [expr $hours % 24]
return "[format "%d days, %02d:%02d:%02d" $days $hours $minutes $seconds]"
}
Only thing left to fix is that it won't choke on non-integers
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Thu Mar 10, 2005 12:28 pm
Code: Select all
if ![regexp \[0-9\] $seconds] {#not integer
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Fri Mar 11, 2005 1:45 am
or try [string is integer -strict $seconds], this would be even true for integers surrounded by whitespaces (which is still a valid integer for expr) and is false on an empty string.
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...
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Fri Mar 11, 2005 2:16 am
Yeah, i was attempting to make a proc which will display the exact count down in seconds etc,
As you are on Quakenet, you are probably familair with Q9 which uses the exact same countdown thing in his permban function