| View previous topic :: View next topic |
| Author |
Message |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Mon Jun 05, 2006 5:12 pm Post subject: Writing something with a delay |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Jun 05, 2006 11:59 pm Post subject: |
|
|
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 |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Tue Jun 06, 2006 4:45 am Post subject: |
|
|
| OK, thank you. It works. |
|
| Back to top |
|
 |
|