| View previous topic :: View next topic |
| Author |
Message |
F-user Voice
Joined: 06 Feb 2010 Posts: 2
|
Posted: Sat Feb 06, 2010 4:52 am Post subject: Invkick.tcl help |
|
|
Okey i have found this script invkick.tcl on egghelp but one problem it isnt working properly!
This error comes in partyline everytime i try to invite bot channel.
Tcl error [invitechan]: invalid channel prefix
Is this problem on script or in my bot?
command /invite botnick #chan
| Quote: |
# Bot invite and kick script, makes the bot respond to invitations and stay away after being kicked.
# There is a build in check for +o status you might want to disable, look at the commented line in the code.
# By [NUT] (nut@fun-industries.nl) a.k.a. dFt^Nut http://www.dftclan.nl
### Config ###
###
# If you dont want invite to be opper only, change this value [1 = on, 0 is off]
###
set oponly "1"
###
# If you are not using an irc network that has a channel limit, set the number of max channels to 0,
# this will disable the maxchan value. Simply set this to your networks maxchan value otherwise.
# [Set to 20 as default (Quakenet)]
###
set chanlim "20"
### Change Log ###
# Version 1
# - Initial release
# Version 1.01
# - Fixed a small bug
# - Changed some configuration options
# Version 1.02
# - Fixed another small bug
# Version 1.03
# - discovered quick and dirty (untested) bug fixes are bad
# - discovered my nickname was disliked by TCL
# - fixed bugs
###
###
# Remember to quit and restart the bot and check for conflicting scripts!
# Not doing this will result in a nonfunctional script. After loading this script and discovering
# it doesnt work dcc into your bot and type .binds (be sure to have scroll back on!) and check the
# binds for command types kick and raw.
###
bind raw - INVITE invitechan
bind kick - * gotkicked
proc invitechan {mask word args} {
global chanlim oponly
set opts [split $mask "!"]
set nick [lindex $opts 0]
set opts [split $args "{:}"]
set chan [lindex $opts 2]
set uhand [nick2hand $nick]
if {$oponly} {
if {![matchattr $uhand "o"]} { return 0 }
}
if {$chanlim > 0} {
if {[llength [channels]] >= $chanlim} {
puthelp "NOTICE $nick :Sadly I cannot join any more channels."
return 0
}
}
channel add $chan {}
save
}
proc gotkicked {nick mask handle chan target reason} {
global botnick chanfile
if {[string match $botnick $target]} {
set isdynamic 0
set channelconf [open $chanfile r]
while {![eof $channelconf]} {
gets $channelconf regel
if {$regel == "" || [string match "#*" $regel]} { continue }
if {[string match -nocase "channel?add?$chan*" $regel]} { set isdynamic 1 } else { continue }
}
if {$isdynamic == "1"} {
channel remove $chan
save
}
}
}
putlog "invkick 1.03 Loaded. Made by NUT" |
Thanks for help |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Feb 09, 2010 5:48 pm Post subject: |
|
|
It's because the coder of this script is making the mistake of using the special token "args" within his procedure header for invitechan. Then they craft crude work-arounds to cleanup what this does.
| Code: | set opts [split $args "{:}"]
set chan [lindex $opts 2] |
Usually when you split raws this way, you want lindex position 1. But here, notice they've used lindex position 2. This is because of the extra bracings introduced by using the special token "args" when using it to replace one argument within a bind. This throws everything off, and special characters will now cause problems and break this script easily. I've rewritten it for you clean, and according to the golden rules of tcl. Enjoy  | Code: | # 0 = no, 1 = yes
set oponly "1"
# how many channels is the max
# you want your bot in?
# set to zero to not use a limit.
set chanlim "20"
# binds
bind raw - INVITE invitechan
bind kick - * gotkicked
# invite
proc invitechan {from key text} {
global chanlim oponly
set nick [lindex [split $from "!"] 0]
set chan [lindex [split $text :] 1]
if {$oponly && ![matchattr [nick2hand $nick] "o"]} { return 0 }
if {$chanlim > 0 && [llength [channels]] >= $chanlim} {
puthelp "NOTICE $nick :Sadly I cannot join any more channels."
return 0
}
channel add $chan
save
}
# kick
proc gotkicked {nick uhost hand chan target reason} {
global chanfile
if {[isbotnick $target]} {
set channelconf [open $chanfile r]
while {![eof $channelconf]} {
gets $channelconf regel
if {$regel == "" || [string match "#*" $regel]} { continue }
if {[string match -nocase "channel?add?$chan*" $regel]} {
channel remove $chan
break
}
}
close $channelconf
}
}
putlog "invite script loaded."
# the reason for using eof is simple, if you downloaded this
# and do NOT see "#eof" as the last line here, then you
# do not have the complete script....
#eof |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
F-user Voice
Joined: 06 Feb 2010 Posts: 2
|
Posted: Sun Feb 21, 2010 7:54 am Post subject: |
|
|
Ok thanks. Now leave for kick works perfectly but still /invite botnick #channel doesn't work
From dcc partyline.
13:53 <botnick> [13:53] Tcl error [invitechan]: invalid channel prefix
13:53 <botnick> [13:53] Anom!anonym@anonymworksi.com invited me to #channel |
|
| Back to top |
|
 |
|
|
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
|
|