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.
Help for those learning Tcl or writing their own scripts.
darton
Op
Posts: 155 Joined: Sat Jan 21, 2006 11:03 am
Post
by darton » Mon Jun 05, 2006 5:12 pm
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: Select all
bind pub - !test test
proc test {nick uhost hand chan arg} {
putserv "PRIVMSG $chan :Test"
utimer 15 { putserv "privmsg $chan : Test" }
}
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Mon Jun 05, 2006 11:59 pm
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: Select all
utimer 15 [list putserv "privmsg $chan :test"]
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
darton
Op
Posts: 155 Joined: Sat Jan 21, 2006 11:03 am
Post
by darton » Tue Jun 06, 2006 4:45 am
OK, thank you. It works.