egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help needed with mass-removing ignores

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
tigwis
Voice


Joined: 28 Jul 2011
Posts: 2

PostPosted: Thu Jul 28, 2011 2:00 pm    Post subject: help needed with mass-removing ignores Reply with quote

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 Sad
Thank you.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Jul 28, 2011 3:44 pm    Post subject: Re: help needed with mass-removing ignores Reply with quote

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 Sad
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
View user's profile Send private message
tigwis
Voice


Joined: 28 Jul 2011
Posts: 2

PostPosted: Thu Jul 28, 2011 5:40 pm    Post subject: Reply with quote

My sincere thanks for this great and helpfull post.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Jul 28, 2011 8:08 pm    Post subject: Reply with quote

You're welcome. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber