| View previous topic :: View next topic |
| Author |
Message |
tigwis Voice
Joined: 28 Jul 2011 Posts: 2
|
Posted: Thu Jul 28, 2011 2:00 pm Post subject: help needed with mass-removing ignores |
|
|
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.
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. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Jul 28, 2011 3:44 pm Post subject: Re: help needed with mass-removing ignores |
|
|
| 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?
| Quote: |
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/1.6.20/tcl-commands.html
and scroll down to:
Bind types
Find:
| Quote: |
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: |
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/1.6.20/tcl-commands.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: |
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} [
Last edited by willyw on Thu Jul 28, 2011 8:06 pm; edited 1 time in total |
|
| Back to top |
|
 |
tigwis Voice
Joined: 28 Jul 2011 Posts: 2
|
Posted: Thu Jul 28, 2011 5:40 pm Post subject: |
|
|
| My sincere thanks for this great and helpfull post. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Jul 28, 2011 8:08 pm Post subject: |
|
|
You're welcome.  |
|
| Back to top |
|
 |
|