tigwis wrote:Dear friends of the TCL language.
I decided to write a script a few days ago for my sc2 clan, that
involves picking a challenger every day at a certain time.
Most of the script is done, but it seems i can not really
manage to do one proc: mass-removing bans.
bans?
or ignores?
Here is what I have thus far:
bind pub - !delignores delignores:pub
proc delignores:pub {vars} {
foreach ignore [ignorelist] { killignore 1 }
}
The error:
[17:52:19] Tcl error [delignores:pub]: wrong # args: should be "delignores:pub vars"
Could someone help me into the right direction?
I must admit that most of my procs are based on examples

Thank you.
Visit:
http://www.eggheads.org/support/egghtml ... mands.html
and scroll down to:
Bind types
Find:
4. PUB
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>
That is describing the way to use
bind pub
and the procedure called by bind pub.
See how there are five variables passed to the procedure?
It doesnt' matter what you name them, but something like this is typical:
Code: Select all
delignores:pub {nick uhost handle chan text} {
# code to run within this proc goes here
}
Not using the right number of variables is the cause of the error you are seeing. You had only one.
Further, while you are at:
http://www.eggheads.org/support/egghtml ... mands.html
find:
killignore <hostmask>
That's telling you that the killignore command does not want a numeral, like you are giving it. It wants the actual hostmask from the current list of ignores, that you wish to kill.
If you use the ignorelist command, you can get that list.
Then, you'd have to index into it, to get the hostmask from the first sublist returned.
Try this:
Code: Select all
foreach ig [ignorelist] {
killignore [lindex $ig 0 ]
}
#this is untested
For information on using lindex , go here:
http://www.tcl.tk/man/tcl8.5/TclCmd/lindex.htm
For information on using foreach, go here:
http://www.tcl.tk/man/tcl8.5/TclCmd/foreach.htm
Main page is here:
http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
I hope this helps.
edit:
fixed typo.
Was:
delignores:pub {nick uhost handle chan text} [