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.

Random line

Old posts that have not been replied to for several years.
Locked
J
Johnny_was

Post by Johnny_was »

Is there a script that when triggered by a certain word in the channel, the bot will read a random line from a text file and say it in the channel?

Thanks
t
thetorpor

Post by thetorpor »

im wondering that too.. i have the code to read a random line from a file here, but its locating the file im having trouble with.
its in my botdir in the text folder. how'd i access that if it was say text.txt?

thanks..
t
thetorpor

Post by thetorpor »

Not dead sure if this is what you can use, but it works for me. If its just grabbing a random line (for say an 8ball or something) you can use this. You can put the lines you want to pick from into the tcl and let this do the rest. hope it works for ya.


bind pub - !randomc pub_random

proc pub_random {nick mask hand channel args} {
global blah
puthelp "PRIVMSG $channel :[lindex $blah [rand [llength $blah]]]"
}

set blah {
"text1 blah blah"
"text2 blahdeblah"
"text3 thingymabob"
}

<font size=-1>[ This Message was edited by: thetorpor on 2002-03-29 09:45 ]</font>
J
Johnny_was

Post by Johnny_was »

That works perfectly...

Many thanks to you.
Locked