| View previous topic :: View next topic |
| Author |
Message |
Thanhas Op

Joined: 02 Sep 2006 Posts: 124 Location: Ottawa, Canada
|
Posted: Sat Nov 03, 2007 2:36 am Post subject: this is not working why ? |
|
|
| Code: | 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: |
[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)
|
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Nov 03, 2007 10:53 am Post subject: |
|
|
You try to execute the proc randomline before you've created it.. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|