egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

usage of "after" command

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Dedan
Master


Joined: 09 Jul 2003
Posts: 260
Location: Memphis

PostPosted: Mon Mar 13, 2006 8:56 pm    Post subject: usage of "after" command Reply with quote

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 Cool
_________________
I once was an intelligent young man, now i am old and i can not remember who i was.
Back to top
View user's profile Send private message
deadite66
Halfop


Joined: 30 May 2005
Posts: 74
Location: Great Yarmouth, UK

PostPosted: Tue Mar 14, 2006 2:51 am    Post subject: Reply with quote

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
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Mar 14, 2006 11:15 am    Post subject: Reply with quote

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 Very Happy.

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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber