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 

utimer help please

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


Joined: 13 Nov 2005
Posts: 3

PostPosted: Sun Nov 13, 2005 1:30 am    Post subject: utimer help please Reply with quote

Hi there,

I currently have a script on the bot that pulls a text file from the server and displays the contents to the channel when it hears the trigger command "!info" on the channel.

The problem I'm having is I wish to add a delay in the script but I cant seem to get the Utimer to work.

I want it so someone in the channel types !info then there is a delay which I can specify before the bot forwards the info to the channel.

The error I was getting was: Tcl error [moo]: wrong # args: should be "utimer seconds command"

current code I am using (without the utimer bits) is:

Code:

package require http
bind pub - !info moo
proc moo {n u h c t} {
   set x [::http::geturl http://www.somewebsite.com/test.txt]
   foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
::http::cleanup $x
}


Just wondering if anyone could please help me out and show me where to put the utimer so the code works properly and I can specify a delay before the bot responds.

Any help would be very much appreciated!

-Billip
Back to top
View user's profile Send private message
ryal
Voice


Joined: 12 May 2005
Posts: 35

PostPosted: Mon Nov 14, 2005 5:28 am    Post subject: Reply with quote

A timer TIMER or UTIMER (difference is that the first works in minutes, the second in seconds) must be used like this:
set mytimer [timer $mytime myaction]
thus if you need to kill it, u use $mytimer to call it
"myaction" is the action taken when the time ends
So basically to do what you want:
*parse the info in the proc moo and store it in a global variable
*at the end of moo set a timer and tell it to call a certain proc "time_to_display" for example
*create time_to_display: make it display the info you have parsed before

Thats it. I quite dont understand why you wanna do that, but thats not of my concern Smile
gl
Back to top
View user's profile Send private message
billip
Voice


Joined: 13 Nov 2005
Posts: 3

PostPosted: Mon Nov 14, 2005 2:31 pm    Post subject: Reply with quote

managed to kill the bot about 10 times but still not managed to get it to work.

I think I understand the theory behind utimers, I just cant figure out how to get it to work with that code.

thanks for the tips though ryal
Back to top
View user's profile Send private message
]Kami[
Owner


Joined: 24 Jul 2003
Posts: 590
Location: Slovenia

PostPosted: Mon Nov 14, 2005 3:31 pm    Post subject: Reply with quote

Code:
package require http
bind pub - !info moo
proc moo {n u h c t} {
   set x [::http::geturl http://www.somewebsite.com/test.txt]
   foreach e [split [::http::data $x] \n] {
   utimer 10 "puthelp \"privmsg $c :$e\""}
::http::cleanup $x
}


Change 10 (seconds) with delay you wind to use.
_________________
Slovene Eggdrop Page
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
billip
Voice


Joined: 13 Nov 2005
Posts: 3

PostPosted: Mon Nov 14, 2005 3:34 pm    Post subject: Reply with quote

thank you kami! and ryal for the hints also.

I tried having the utimer just about everywhere but I never tried it inside those brackets.

cheers for the help!
Back to top
View user's profile Send private message
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