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 

[TCL ERROR] wrong # args {{Solved}}
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Tue Jul 14, 2009 8:50 pm    Post subject: [TCL ERROR] wrong # args {{Solved}} Reply with quote

Error:

Code:

[23:24] Tcl error [CoreBan]: wrong # args: should be "stricthost host chan"



Snippit:

Code:

bind pub l|l !Ban CoreBan



proc stricthost {host chan} {
   if {![string match "*@*" $host]} {
      return [maskhost "[string trimleft $host "!"]![getchanhost $host $chan]"]
   }
   return [maskhost $host]
}



proc CoreBan { nick host hand chan text } {
   set who [lindex [split $text] 0]
   set why [lrange [split $text] 1 end]
   set whohost [stricthost [lindex [split $text] 0]]
   putquick "MODE $chan +b $whohost"
   putquick "KICK $chan $who $why"
}



Just wondering, what does "wrong # args" generally mean, so I don't have to waste anyone time with opening a new thread?




Thank you!
Branden


Last edited by Branden on Thu Jul 16, 2009 3:31 pm; edited 3 times in total
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue Jul 14, 2009 9:33 pm    Post subject: Reply with quote

Code:
set whohost [stricthost [lindex [split $text] 0] $chan]


You've tied chan as an argument in your procedure. This is why you can't invoke it without specifying the chan parameter as well as the host.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Tue Jul 14, 2009 9:42 pm    Post subject: Reply with quote

Thank you!
Back to top
View user's profile Send private message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Wed Jul 15, 2009 7:46 pm    Post subject: Reply with quote

ERROR:



Code:
[00:27] Tcl error [CorePermBan]: wrong # args: should be "stick ban ?channel?"




SCRIPT:


Code:
proc CorePermBan { nick host hand chan text } {
   set who [lindex [split $text] 0]
   set why [lrange [split $text] 1 end]
   set whohost [stricthost [lindex [split $text] 0] $chan]
   putquick "MODE $chan +b $whohost"
   putquick "KICK $chan $who $why"
   stick ban $whohost
}




Sorry to be a pain!
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Jul 15, 2009 8:01 pm    Post subject: Reply with quote

How do you supoose to stick the ban thats never been set correctly? Your using putquick'd mode changes, not eggdrops internal bans to catch this. Perhaps you should use:
Code:

proc CorePermBan { nick host hand chan text } {
   set who [lindex [split $text] 0]
   set why [lrange [split $text] 1 end]
   set whohost [stricthost [lindex [split $text] 0] $chan]
   putquick "MODE $chan +b $whohost"
   putquick "KICK $chan $who :$why"
   newchanban $chan $whohost "$nick-PUB" $why 0
   stick ban $whohost $chan
}

As you can see, you forgot the $chan parameter of the stick command. You also forgot to put the colon between $who and $why in your putquick'd kick, meaning the ircd would always kick users without giving your entire $why reason. It would've only given the first word used, not the entire sentence. This is what the colon is for.
_________________
speechles' eggdrop tcl archive


Last edited by speechles on Wed Jul 15, 2009 8:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Wed Jul 15, 2009 8:11 pm    Post subject: Reply with quote

speechles wrote:
How do you supoose to stick the ban thats never been set correctly? Your using putquick'd mode changes, not eggdrops internal bans to catch this. Perhaps you should use:
Code:

proc CorePermBan { nick host hand chan text } {
   set who [lindex [split $text] 0]
   set why [lrange [split $text] 1 end]
   set whohost [stricthost [lindex [split $text] 0] $chan]
   putquick "MODE $chan +b $whohost"
   putquick "KICK $chan $who :$why"
   newchanban $chan $whohost "$nick-PUB" $why 0
   stick ban $whohost $chan
}

As you can see, you forgot the $chan parameter of the stick command. You also forgot to put the colon between $who and $why in your putquick'd kick, meaning the ircd would always kick users without giving your $why reason.



Yeah, I was trying to do that instead, but the bot isn't setting the ban at all with newchanban, and it's not outputting any errors.
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Wed Jul 15, 2009 8:21 pm    Post subject: Reply with quote

Code:
proc CorePermBan { nick host hand chan text } {
   set who [lindex [split $text] 0]
   set why [lrange [split $text] 1 end]
   set whohost [stricthost [lindex [split $text] 0] $chan]
   putquick "MODE $chan +b $whohost"
   putquick "KICK $chan $who :$why"
   newchanban $chan $whohost $nick-PUB "$why" 0 sticky
   if {![isbansticky $whohost $chan]} {
    stick $whohost $chan
   }
}

_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Wed Jul 15, 2009 8:24 pm    Post subject: Reply with quote

"newchanban" is still not working nor outputting any errors. :S
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Thu Jul 16, 2009 11:57 am    Post subject: Reply with quote

The variable why should be converted back to a string rather than left as a list

Code:

set why [join [lrange [split $text] 1 end]]


I don't see $nick-PUB defined anywhere within the scope of the proc CorePermBan, did you mean $nick?

"$why" is in quotes in the newchanban and doesn't need to be

The following code seems superfluous, since the newchanban is set as sticky explicitly

Code:

if {![isbansticky $whohost $chan]} {
    stick $whohost $chan
}

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Thu Jul 16, 2009 1:23 pm    Post subject: Reply with quote

The use of $nick-PUB was to set the owner of the ban to the person's nickname that issued the command plus the tag "-PUB" Smile and Yes, its superfluous Razz but i prefer to include it Wink

As for newchanban not working, you could trying removing the putquick' and stuff, since added a ban via newchanban will already result in a ban and kick of any/all users matching the given address.
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Thu Jul 16, 2009 1:44 pm    Post subject: Reply with quote

The Tcl interpreter will look for a variable named nick-PUB since there is nothing to suggest that -PUB is tagged onto the value of the variable nick.

Use $nick\-PUB

Though I accept it does work
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Thu Jul 16, 2009 2:29 pm    Post subject: Reply with quote

Code:

bind PUB l|l !ban pCoreBan

proc pCoreBan {nick uhost hand chan text} {
    set who [lindex [split $text] 0]
    set why [join [lrange [split $text] 1 end]]
    switch -- [regexp -- {\.} $who] {
        0 {
            if {[onchan $who]} {
                set host [maskhost [getchanhost $who]]
            }
        }
        1 {set host [maskhost $who]}
        default {}
    }
    if {[info exists host]} {newchanban $chan $host $nick\-PUB $why 0 sticky}
    return 0
}

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jul 16, 2009 2:56 pm    Post subject: Reply with quote

arfer:
Regarding $nick-PUB, due to various mechanics in tcl, if you intend to have a dash (-) in the name of a variable, you'll have to enclose it using {} when reading it. Ie: ${nick-PUB}. Otherwise, the dash is taken as the end of the variable name. As such, speechles' and TCL_no_TK's approach is fully valid, although perhaps not the best of practice in demonstration. The proper way to "tag" in the case of other characters than dash, once again you would use the {}; Ie: ${nick}-PUB.

So far, I've seen several different approaches to use newchanban, and all seem perfectly valid. Perhaps focus on figuring out why newchanban does not set the ban on the channel instead?

Branden:
Think you could post your channel settings (use .chaninfo from the dcc chat partyline)? Especially the dynamicbans and enforcebans (shouldn't matter since we've got it sticky though).
Could you check whether the new bans are added to your eggdrop's internal banlist (use .bans all from the dcc chat partyline)?
Also, have you verified that the generated banmask isn't blocked by the server (numerous ircd's these days bounce bans that match already active bans on the channel).
Other things to check, that the ban/invite/exempt-list isn't full, and that your eggdrop's setting match the ircd's capabilities..
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Thu Jul 16, 2009 3:31 pm    Post subject: Reply with quote

Ah, really sorry, the error was on my end...

I had the bot opered up, and it wasn't +o in the room, therefore it wasn't setting the modes.


I'll never make that mistake again. :]



Thank you all for your help!
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Thu Jul 16, 2009 3:55 pm    Post subject: Reply with quote

OK nml375, I see that now. Thanks. It did look rather strange at first sight
_________________
I must have had nothing to do
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
Goto page 1, 2  Next
Page 1 of 2

 
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