| View previous topic :: View next topic |
| Author |
Message |
Dedan Master

Joined: 09 Jul 2003 Posts: 260 Location: Memphis
|
Posted: Mon Mar 13, 2006 8:56 pm Post subject: usage of "after" command |
|
|
i searched the forum and found nothing to my suprise.
i am having a problem finding the
proper format of this command, i
am not even sure it can be used in
the way i need it.
I have a loop that will loop about
60,000 times and i want to place a "pause"
in it.
| Code: |
foreach t $tenthousands {
blah
blah
after
}
|
thanks for you help  _________________ I once was an intelligent young man, now i am old and i can not remember who i was. |
|
| Back to top |
|
 |
deadite66 Halfop
Joined: 30 May 2005 Posts: 74 Location: Great Yarmouth, UK
|
Posted: Tue Mar 14, 2006 2:51 am Post subject: |
|
|
http://www.tcl.tk/man/tcl8.4/TclCmd/after.htm
i believe the after command in eggdrop has to run a command/proc you can't use it as a pause.
i tried it once in a script as a pause and the irc logs times recorded were all out of sync. _________________ <- tcl newb |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Tue Mar 14, 2006 11:15 am Post subject: |
|
|
Well I haven't used after till now, because I did not have a reason for it till now. First you will not be able to use it withing a loop of any kind. Best you save were you have been in a global var or forward it via argument and then call the command from the beginning. If I read manual right you should be able to able to use it like:
| Code: | | after 100 myproc $myarg1 $myarg2 $myarg3 $position |
should execute it after 100ms. But I am not sure if this will really work in eggdrops. Maybe you can use the event functions built in eggdrop. No idea if custom events can be bound like "bind evnt - custom proc" and trigger with "event custom".
I personally would try to optimize the script to not consume that much CPU time, because I would probably get kicked of my shell for doing so .
Edit:
| Code: | [-RO^Bot-] [12:16:22] tcl: evaluate (.tcl): set testtime [clock clicks -milliseconds]; after 1000 putdcc 13 {[expr {[clock clicks -milliseconds] - $testtime}]ms}
[-RO^Bot-] Tcl: after#5
[-RO^Bot-] 1010ms |
works like a charm _________________ 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... |
|
| Back to top |
|
 |
|