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.
b
brentos
Post
by brentos » Wed Apr 02, 2003 9:49 pm
I am making a trivia bot and I use utimers to decide when the question goes unansered due to time limit. The only thing is if I use the command to stop the bot it is told to kill all the timer and Display a msg saying that trivia is stoped. The only problem is that the timer still keeps running. I put the stop the msg gets printed but after the time limit comes to an end it continues by calling the proc specified in the timer.
Any ideas anyone
I am new to tcl so i can use the help lol
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Wed Apr 02, 2003 10:27 pm
You must not be killing the timer right. use killutimer $timerid, where $timerid is the code returned by the utimer command.
b
brentos
Post
by brentos » Thu Apr 03, 2003 9:10 pm
So are you say that you can just kill the timer by using the variable name that you assigned it to? You have to preform the utimer on the variable to get the ID and then kill it?
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Thu Apr 03, 2003 11:04 pm
no the utimer command returns a timer id
set timerid [utimer 30 blah]
killutimer $timerid
b
brentos
Post
by brentos » Tue Apr 08, 2003 7:50 pm
I do kill it like that but it still doesn't work
In one module i put
set timeovertimer [utimer 60 tgover]
and in the kill module i say
killutimer timeovertimer
And it won't work
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Tue Apr 08, 2003 7:59 pm
It doesn't work like that.
You need to get the general idea of the syntax of Tcl.
The "killtimer" command uses a timerid, not a variable name.
The timerid can however, come from within a variable, thus you use it likke "$timerid".
Dedan
Master
Posts: 260 Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis
Post
by Dedan » Mon Dec 15, 2003 10:27 pm
does the code below set AND
start the timer, or only set a var?
Code: Select all
set mytimer [utimer $av_seconds [list av:dec $chan]]
and is this the proper way to kill the above timer?
Code: Select all
if {[info exists mytimer]} {
killutimer $mytimer
}
I once was an intelligent young man, now i am old and i can not remember who i was.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Dec 16, 2003 1:16 pm
Dedan wrote: does the code below set AND
start the timer, or only set a var?
Code: Select all
set mytimer [utimer $av_seconds [list av:dec $chan]]
[snip]
this starts the timer and returns a timer id in the var $mytimer.
Dedan wrote:
and is this the proper way to kill the above timer?
Code: Select all
if {[info exists mytimer]} {
killutimer $mytimer
}
if $mytimer is running then this will work, but this will also work even when there is no $mytimer running in [utimers] so this will return an error "
invalid timerID "
Dedan
Master
Posts: 260 Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis
Post
by Dedan » Wed Dec 17, 2003 3:49 pm
so, how are you checking if that timer is running?
I once was an intelligent young man, now i am old and i can not remember who i was.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Dec 17, 2003 5:16 pm
Code: Select all
foreach utimer [utimers] {
if {[string match $mytimer [lindex $utimer 2]]} {
killutimer $mytimer
}
}
this should do it.
Dedan
Master
Posts: 260 Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis
Post
by Dedan » Wed Dec 17, 2003 5:32 pm
thanks
I once was an intelligent young man, now i am old and i can not remember who i was.