I have a ChanLink script, who works perfectly, except for one proc, and I don't understand why.
Here is the code :
Code: Select all
set chan #MyChan
set net MyNetwork
set netid 1234
bind dcc - chanlink do_say_link_onoff
bind bot - said do_say_chan
bind bot - join do_join_chan
bind bot - part do_part_chan
bind bot - sign do_sign_chan
bind bot - list do_chan_list
bind bot - return do_say_list
bind pubm - * do_say_bot
bind join - *!*@* do_join_bot
bind part - *!*@* do_part_bot
bind sign - *!*@* do_sign_bot
bind pub - .list do_chan_bot
bind mode - * do_mode_bot
bind bot - mode do_mode_chan
bind nick - * do_nickchange_bot
bind bot - nickchange do_nickchange_chan
bind ctcp - ACTION do_action_bot
bind bot - action do_action_chan
bind topc - * do_topic_bot
bind bot - topicchange do_topic_chan
bind pub - .nets do_nets_bot
bind bot - REPORT do_nets_botback
bind bot - reportback do_nets_chan
proc do_say_link_onoff {hand idx args} {
set answer [string tolower [lindex $args 0]]
if {$args == "on"} {
bind bot - said do_say_chan
bind bot - join do_join_chan
bind bot - part do_part_chan
bind bot - sign do_sign_chan
bind bot - list do_chan_list
bind bot - return do_say_list
bind pubm - * do_say_bot
bind join - *!*@* do_join_bot
bind part - *!*@* do_part_bot
bind sign - *!*@* do_sign_bot
bind pub - .list do_chan_bot
bind mode - * do_mode_bot
bind bot - mode do_mode_chan
bind nick - * do_nickchange_bot
bind bot - nickchange do_nickchange_chan
bind ctcp - ACTION do_action_bot
bind bot - action do_action_chan
bind topc - * do_topic_bot
bind bot - topicchange do_topic_chan
bind pub - .nets do_nets_bot
bind bot - REPORT do_nets_botback
bind bot - reportback do_nets_chan
putdcc $idx "Cross-Net has been enabled"
return 0}
if {$args == "off"} {
unbind bot - said do_say_chan
unbind bot - join do_join_chan
unbind bot - part do_part_chan
unbind bot - sign do_sign_chan
unbind bot - list do_chan_list
unbind bot - return do_say_list
unbind pubm - * do_say_bot
unbind join - *!*@* do_join_bot
unbind part - *!*@* do_part_bot
unbind sign - *!*@* do_sign_bot
unbind pub - .list do_chan_bot
unbind mode - * do_mode_bot
unbind bot - mode do_mode_chan
unbind nick - * do_nickchange_bot
unbind bot - nickchange do_nickchange_chan
unbind ctcp - ACTION do_action_bot
unbind bot - action do_action_chan
unbind topc - * do_topic_bot
unbind bot - topicchange do_topic_chan
unbind pub - .nets do_nets_bot
unbind bot - REPORT do_nets_botback
unbind bot - reportback do_nets_chan
putdcc $idx "Cross-Net has been disabled"
return 0}
putdcc $idx "Invalid Command"
return 0}
proc do_nets_bot {nick mask hand channel args} {
global net chan botnick netid
putallbots "REPORT $netid"
putserv "PRIVMSG $chan :\-\=\[ NETS REPORT \]\=\-"
putserv "PRIVMSG $chan :\[$botnick\] $net"
return 0}
proc do_nets_botback {from com args} {
global botnick net netid
set args [lindex $args 0]
set nid [lindex $args 0]
if {$netid == $nid} {
putbot $from "reportback $netid $botnick $net"}
return 0}
proc do_nets_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set botnick [lindex $args 1]
set net [lindex $args 2]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$botnick\] $net"}
return 0}
proc do_topic_bot {nick mask hand chan topic} {
global net botnick netid
putallbots "topicchange $netid $botnick $net $nick $topic"
return 0}
proc do_topic_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set botnick [lindex $args 1]
set net [lindex $args 2]
set nick [lindex $args 3]
set topic [lrange $args 4 end]
if {$netid == $nid} {
if {$botnick != $nick} {
putserv "PRIVMSG $chan :\[$net\] \*\*\* $nick sets topic \"$topic\" "
putserv "TOPIC $chan :$topic"}}
return 0}
proc do_action_bot {nick mask hand dest key args} {
global net netid
putallbots "action $netid $net $nick [join $args]"
return 0}
proc do_action_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set nick [lindex $args 2]
set action [lrange $args 3 end]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$net\] \* $nick $action"}
return 0}
proc do_nickchange_bot {nick mask hand chan newnick} {
global net netid
putallbots "nickchange $netid $net $nick $newnick $mask"
return 0}
proc do_nickchange_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set nick [lindex $args 2]
set new [lindex $args 3]
set mask [lindex $args 4]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$net\] \*\*\* $nick is now known as $new"}
return 0}
proc do_mode_bot {nick mask hand chan mode} {
global net netid
putallbots "mode $netid $net $nick $mode"
return 0}
proc do_mode_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set nick [lindex $args 2]
set mode [lrange $args 3 end]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$net\] \*\*\* $nick sets mode: $mode"}
return 0}
proc do_chan_bot {nick mask hand chan args} {
global netid
set net [lindex $args 0]
putallbots "list $netid $net"
return 0}
proc do_chan_list {from com args} {
global net chan netid
set list [chanlist $chan -]
set args [lindex $args 0]
set nid [lindex $args 0]
set net2 [lindex $args 1]
if {$netid == $nid} {
if {$net == $net2} {
set list [join $list]
putbot $from "return $netid $net $list"
return 0}}
return 0}
proc do_say_list {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set clist [lrange $args 2 end]
set clist [join $clist]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$chan@$net\] $clist"}
return 0}
proc do_say_bot {nick mask hand chan text} {
global net netid
putallbots "said $netid $net $nick $mask $text"
return 0
}
proc do_join_bot {nick mask hand chan} {
global net netid
putallbots "join $netid $net $nick $mask"
return 0
}
proc do_sign_bot {nick host hand chan reason} {
global net netid
putallbots "sign $netid $net $nick $host $reason"
return 0}
proc do_sign_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set nick [lindex $args 2]
set host [lindex $args 3]
set reas [lrange $args 4 end]
if {$netid == $nid} {
putserv "PRIVMSG $chan :Signoff $nick@$net \($host\) \($reas\)"}
return 0
}
proc do_join_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set nick [lindex $args 2]
set host [lindex $args 3]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$net\] \*\*\* Join $nick \($host\)"}
return 0
}
proc do_part_bot {nick mask hand chan} {
global net netid
putallbots "part $netid $net $nick $mask"
return 0
}
proc do_part_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set nick [lindex $args 2]
set host [lindex $args 3]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\[$net\] \*\*\* Part $nick \($host\)"}
return 0
}
proc do_say_chan {from com args} {
global chan netid
set args [lindex $args 0]
set nid [lindex $args 0]
set net [lindex $args 1]
set who [lindex $args 2]
set mask [lindex $args 3]
set what [lrange $args 4 end]
if {$netid == $nid} {
putserv "PRIVMSG $chan :\<$who@$net\> $what"}
return 0}
Code: Select all
Tcl error [do_part_bot]: wrong # args: should be "do_part_bot nick mask hand chan"