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.

Starting a Value to count.

Old posts that have not been replied to for several years.
Locked
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Starting a Value to count.

Post by spyda »

Hi all again.. Lost all my data, so i have started my TCL's again!

Got a little problem with timers. Try to set a value to count in milliseconds until stop and changed into real time.

But everytime it goes and exec it.. I get a error :cry:

Code: Select all

proc status:evnt:connect {filter} {
 if {![info exits $testuptime]} { 
  set testuptime [clock clicks -milliseconds]
  }
 putlog "$test"
}

proc status:evnt:disconnect {filter} {
 global testuptime
 set wtest [expr [expr [clock clicks -milliseconds]-$testuptime]/1000.00]
 putlog "$wtest"
}
Error:
Tcl error [status:evnt:connect]: can't read "testuptime": no such variable
I bet you it is something real simple... But i cant work it out. If there is any other way that is more user friendly or work better i would love to know. Thanx for anyhelp

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

Post by pollar »

I think you should define testupdate as global variable in status:evnt:connect. Try this:

Code: Select all

proc status:evnt:connect {filter} {
global testuptime
if {![info exits $testuptime]} { 
  set testuptime [clock clicks -milliseconds] 
  } 
putlog "$test" 
} 

proc status:evnt:disconnect {filter} { 
global testuptime 
set wtest [expr [expr [clock clicks -milliseconds]-$testuptime]/1000.00] 
putlog "$wtest"
catch {unset  testuptime}
} 
Locked