This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
Pitchat
Op
Posts: 122 Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:
Post
by Pitchat » Tue Dec 28, 2004 1:06 am
Hi ,
I`ve look at the tutorial on how to work with files but i still can`t get my simple script to work ( maybe it is too simple and i do something wrong)
here`s what i want to do
and a trigger like !random i want my eggdrop to read a random line in a file call random.txt and say it on channel
that`s all
thank for any help like always
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Dec 28, 2004 2:42 am
Code: Select all
if ![catch {set f [open file.txt]}] {
while {![eof $f]} {lappend t [gets $f]}
bind pub - !random foo; close $f
}
proc foo {n u h c t} {
puthelp "privmsg $c :[lindex $::t [rand [llength $::t]]]"
}
Pitchat
Op
Posts: 122 Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:
Post
by Pitchat » Tue Dec 28, 2004 3:56 am
works perfectly thanks a lot !