The error massge is quite meaningful in this situation.
Code: Select all
proc unban {} {
global chan
putserv "MODE $chan -b ban1*!*@*"
}
Note the use of $chan.
This variable does not exists in the proc.
It must be created, or imported via 1 of three ways.
1, to explictly set the variable using th set command within the proc, but before the use of $chan.
Code: Select all
proc unban {} {
set chan #blah
putserv "MODE $chan -b ban1*!*@*"
}
2, to have it imported as part of passed arguments, in the proc definition
Code: Select all
proc unban {chan} {
putserv "MODE $chan -b ban1*!*@*"
}
3, to get the variable from a globaly defined on (as allready used in your script
Code: Select all
proc unban {} {
global chan
putserv "MODE $chan -b ban1*!*@*"
}
Your code is wrong however. Allthough ti is tryign to get a global variable. The fact that this variable doesn't exist globaly, means that it will error as such.
You best bet would be to use method 2.
In the time command, you can send the channel name accross, along with calling the command.
Looking at your snippet, you could use somthing like
Code: Select all
if {![info exists bans]} {set bans [timer 1 [list unban $chan]]} (...)
alogn with the explae code I used in method 2.