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 

Writing something with a delay

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


Joined: 21 Jan 2006
Posts: 155

PostPosted: Mon Jun 05, 2006 5:12 pm    Post subject: Writing something with a delay Reply with quote

Hello!
When somebody in the channel writes a certain command, my bot should write something back and after 15 seconds a second message. So I made this script but there must be something wrong, because an error occurs: "can't read "chan": no such variable"
Code:
bind pub - !test test
proc test {nick uhost hand chan arg} {
putserv "PRIVMSG $chan :Test"
utimer 15 { putserv "privmsg $chan : Test" }
}
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Jun 05, 2006 11:59 pm    Post subject: Reply with quote

the utimer script executes outside the proc context, therefore $chan is not available for evaluation at execution time

the usual solution to this problem is to force evaluation of $chan inside the proc:
Code:

utimer 15 [list putserv "privmsg $chan :test"]

_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Tue Jun 06, 2006 4:45 am    Post subject: Reply with quote

OK, thank you. It works.
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