I am testing a rather neat script that does autogreets with a difference, it doesn't greet every Tom, Dick & Harry that enters a channel (a feature I really like). The problem is that it generates the following error (of and on)...
Tcl error in script for 'timerxxx':
invalid command name "1"
I am unable to contact the author as his e-mail addresses are no longer valid and even a memo on an IRC network proved fruitless.
Here is the main code:
bind join - ***** greet_join
proc greet_join {nick uhost hand chan} {
global botnick publics
if {$publics == 0} {return 0}
if {$botnick == $nick} {return 1}
if {![greetchan $chan]} {return 1}
utimer [expr [rand 15] + 5] [greet_do $nick $chan]
return 1
}
proc greet_do {nick chan} {
global greet
set gnick $nick
set anick ""
set gloop 0;
while {$gloop < [string length $nick]} {
if {[string match "*[string index $nick $gloop]*" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"]} {set anick "$anick[string index $nick $gloop]"}
incr gloop 1
}
if {[string length $anick] < 3} {set anick $nick}
# putlog "greet_do $nick $chan anick:$anick gnick:$gnick"
if {![onchan $nick $chan]} {return 1}
if {![probability $greet(greetprob)]} {return 1}
if {![probability $greet(snaprob)]} {set gnick $anick}
if {![probability $greet(nlowprob)]} {set gnick [string tolower $gnick]}
set outmsg [randomline $greet(lines)]
if {[probability $greet(mlowprob)]} {set outmsg [string tolower $outmsg]}
if {([probability $greet(end1prob)]) && ([string index $outmsg [expr [string length $outmsg] - 1]] != "?")} {append outmsg [randomline $greet(endings1)]}
if {[probability $greet(end2prob)]} {append outmsg [randomline $greet(endings2)]}
regsub -all {\$nick} $outmsg $gnick outmsg
regsub -all {\$chan} $outmsg $chan outmsg
regsub -all {\\001} $outmsg \001 outmsg
regsub -all {\\002} $outmsg \002 outmsg
switch $greet(notification) {
1 {putserv "PRIVMSG $chan :$outmsg"}
2 {putserv "PRIVMSG $nick :$outmsg"}
3 {putserv "NOTICE $nick :$outmsg"}
}
}
proc randomline {text} {
return [lindex $text [rand [llength $text]]]
}
proc greetchan {chan} {
global greet
set chan [string tolower $chan]
set chans [string tolower $greet(chans)]
if {$chan == "*"} {set chans [string tolower [channels]]}
set dothechan 0
foreach c $chans {
if {($chan == $c)} {set dothechan 1}
}
if {$dothechan == 0} {return 0} else {return 1}
}
proc probability {prob} {
if {$prob == 100} {return 1}
set r [rand 100]
set rng [rand [expr 100 - $prob]]
set rngu [expr $rng + $prob]
# putlog "prob:$prob r:$r range: $rng - $rngu"
if {($r > $rng) && ($r < $rngu)} {return 1}
return 0
}
I am not exactly sure what to do to fix it. Everytime I "fiddle" I seem to upset something and every nick that enters a channel ends up getting greeted, which is not what I want.
Many thanks for *any* help on this.

PS: This script is about 3 years old.