Code: Select all
set slap "./slap.txt"
set slapmsg [string range [randomline $slap] 0 end]
# Insert your own procedure.
proc randomline { filename } {
set position [rand [expr [file size $filename] - 1024]]
set fd [open $filename r]
catch {
seek $fd $position
set text [read $fd 1024]
}
close $fd
set lines [split $text \n]
set lineno [randrange 1 [expr [llength $lines] - 1]]
return [lindex $lines $lineno]
}
The Errors are...
Code: Select all
[06:28] Tcl error in file 'HosTer.conf':
[06:28] invalid command name "randomline"
while executing
"randomline $slap"
invoked from within
"string range [randomline $slap] 1 end"
invoked from within
"set slapmsg [string range [randomline $slap] 1 end] "
(file "scripts/slap.tcl" line 2)
invoked from within
"source scripts/slap.tcl"
(file "HosTer.conf" line 262)
[06:28] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)