Code: Select all
# Master script
### SETTINGS
set egglist { "egg1" "egg2" "egg3" "egg4"}
# Masta must be in this list, the better position is first
# nicks in the list are botnet-nick
set comlist {
"command1 is usefull for nothing"
"command2 won't be used"
"command3 is the best for n00b"
"command4 is the last"
}
# that's the array containning all the texts, refer to escape characters to avoid troubles...
### BINDS
bind pub - "!command" list:send
# just a bind :)
### PROCEDURES
proc list:send {nick uhost handle chan arg} {
global egglist comlist
set cur_egg 0
foreach cur_com $comlist {
if { [lindex cur_egg $egglist] == $botnick } {
puthelp "PRIVMSG $chan :$cur_com"
} else {
putbot [lindex cur_egg $egglist] [concat ">say" $cur_com]
}
incr cur_egg
if { $cur_egg == [llength $com_list] } {
set cur_egg 0
}
}
}
# end of master script
# Slave script
### SETTINGS
set master_egg "egg1"
# The botnet-nick of the sender
set saychan "#yourchan"
### BINDS
bind bot - ">say" list:say
### PROCEDURES
proc list:say { from cmd arg } {
global saychan master_egg
if { $from == $master_egg } {
puthelp "PRIVMSG $saychan :$arg"
}
}
# end of slave script
Code: Select all
Tcl error [list:send]: bad index "aPa": must be integer or end?-integer?
Code: Select all
proc list:send {nick uhost handle chan arg} {
global egglist comlist
set cur_egg 0
foreach cur_com $comlist {
if { [lindex $cur_egg $egglist] == $botnick } {
puthelp "PRIVMSG $chan :$cur_com"
} else {
putbot [lindex $cur_egg $egglist] [concat ">say" $cur_com]
}
incr cur_egg
if { $cur_egg == [llength $com_list] } {
set cur_egg 0
}
}
}
Code: Select all
Tcl error [list:send]: bad index "apa": must be integer or end?-integer?
Code: Select all
proc list:send {nick uhost handle chan arg} {
global egglist comlist botnick
set cur_egg 0
foreach cur_com $comlist {
if { [lindex $egglist $cur_egg] == $botnick } {
puthelp "PRIVMSG $chan :$cur_com"
} else {
putbot [lindex $egglist $cur_egg] [concat ">say" $cur_com]
}
incr cur_egg
if { $cur_egg == [llength $comlist] } {
set cur_egg 0
}
}
}
Code: Select all
incr cur_egg
if { $cur_egg == [llength $com_list] } {
set cur_egg 0
Code: Select all
putbot [lindex $egglist $cur_egg] [concat ">say" $cur_com]
becomes:
putbot [lindex $egglist $cur_egg] [concat ">say $nick" $cur_com]
and
puthelp "PRIVMSG $chan :$cur_com"
becomes
puthelp "NOTICE $nick :$cur_com"
Code: Select all
proc list:say { from cmd arg } {
global saychan master_egg
if { $from == $master_egg } {
puthelp "PRIVMSG $saychan :$arg"
}
}
becomes
proc list:say { from cmd arg } {
global saychan master_egg
set nick [lindex $arg 0]
set text [lrange $arg 1 end]
if { $from == $master_egg } {
puthelp "NOTICE $nick :$text"
}
}