| View previous topic :: View next topic |
| Author |
Message |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Tue Jul 14, 2009 8:50 pm Post subject: [TCL ERROR] wrong # args {{Solved}} |
|
|
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 |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Jul 14, 2009 9:33 pm Post subject: |
|
|
| 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 |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Tue Jul 14, 2009 9:42 pm Post subject: |
|
|
| Thank you! |
|
| Back to top |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Wed Jul 15, 2009 7:46 pm Post subject: |
|
|
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 |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Jul 15, 2009 8:01 pm Post subject: |
|
|
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 |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Wed Jul 15, 2009 8:11 pm Post subject: |
|
|
| 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 |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Wed Jul 15, 2009 8:21 pm Post subject: |
|
|
| 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 |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Wed Jul 15, 2009 8:24 pm Post subject: |
|
|
| "newchanban" is still not working nor outputting any errors. :S |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Thu Jul 16, 2009 11:57 am Post subject: |
|
|
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 |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Thu Jul 16, 2009 1:23 pm Post subject: |
|
|
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" and Yes, its superfluous but i prefer to include it
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Thu Jul 16, 2009 1:44 pm Post subject: |
|
|
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Thu Jul 16, 2009 2:29 pm Post subject: |
|
|
| 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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jul 16, 2009 2:56 pm Post subject: |
|
|
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 |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Thu Jul 16, 2009 3:31 pm Post subject: |
|
|
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Thu Jul 16, 2009 3:55 pm Post subject: |
|
|
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 |
|
 |
|