I need a small script which will make my bot msg randomly anyone in the channel after every x minutes op/voices are exempted they wont be msged by the bot. One more thing, if the bot msgs someone then it wont msg that nick until that nick parts the channel or quits from IRC.
is it possible that you create me this small script.
set randmsg(time) 10
set randmsg(chan) #channel
set randmsg(msgs) {
"msg 1"
"msg 2"
"msg 3"
}
bind time - * send:msg
bind part - * rem:nick
bind sign - * rem:nick
bind kick - * rem:nick
proc send:msg {m h args} {
global randmsg
if {([scan $m %d]+([scan $h %d]*60)) % $randmsg(time) == 0} {
set cl [split [string tolower [join [chanlist $randmsg(chan)]]]]
set cll [llength $cl]
set n [lindex $cl [rand $cll]]
while {[set c [expr {[isvoice $n $randmsg($chan)] || [isop $n $randmsg(chan)] || [info exists randmsg(n:$n)]}]]} {
set i [lsearch -exact $cl $n]
set cl [lreplace $cl $i $i]
if {[incr cll -1] < 1} {break}
set n [lindex $cl [rand $cll]]
}
if {!$c} {
puthelp "privmsg $n :[lindex $randmsg(msgs) [rand [llength $randmsg(msgs)]]]"
set randmsg(n:$n) 1
}
}
}
proc rem:nick {nick uhost hand chan arg {rsn ""}} {
global randmsg
if {$rsn != ""} { set nick $arg }
if {[info exists randmsg(n:[set nick [string tolower $nick]])]} {
unset randmsg(n:$nick)
}
}
Edit: Now it should not msg ops/voices and nicks that have already been msged unless they part/quit.
Edit2: Fixed error.
Edit3: Added refresh list on kick as well.
Last edited by Sir_Fz on Fri Jun 22, 2007 7:48 pm, edited 5 times in total.
[17:37] <ShetanGal> [17:38] Just msged lair
[17:38] <ShetanGal> [17:39] Just msged cancerian
[17:39] <ShetanGal> [17:40] Just msged cheetah
[17:40] <ShetanGal> [17:41] Just msged shetangal
[17:41] <ShetanGal> [17:42] Just msged lair
[17:42] <ShetanGal> [17:43] Just msged alone_m_isb
You see the nickname lair comes 2 times lair is an op too and bot msges itself as it's nickname is ShetanGal.
[03:02] <ShetanGal> [03:03] Tcl error [send:msg]: random limit must be greater than zero
[03:03] <ShetanGal> [03:04] Tcl error [send:msg]: random limit must be greater than zero
[03:04] <ShetanGal> [03:05] Tcl error [send:msg]: random limit must be greater than zero