
proc lrandom {L} { lindex $L [expr { int(rand()*[llength $L]) }] }

bind pub - hello pub_hello2
bind pub - hi pub_hello2
bind pub - hii pub_hello2
bind pub - hiii pub_hello2
bind pub - hiiii pub_hello2
bind pub - hiiiii pub_hello2
bind pub - hiiiiii pub_hello2
bind pub - howdy pub_hello2
bind pub - hiya pub_hello2

set file "/eggdrop/scripts/bottalk/hi.txt"
set fid [open $file r]
set ranhello [split [read $fid] \n]
close $fid

proc pub_hello2 {nick uhost hand chan $ranhello} {
if [rand 2] {
putchan $chan [string map [list <nick> $nick] [lrandom $::ranhello]]
}
return 1
}    