egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

this is not working why ?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Thanhas
Op


Joined: 02 Sep 2006
Posts: 124
Location: Ottawa, Canada

PostPosted: Sat Nov 03, 2007 2:36 am    Post subject: this is not working why ? Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Nov 03, 2007 10:53 am    Post subject: Reply with quote

You try to execute the proc randomline before you've created it..
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber