Burke-1 Voice
Joined: 28 Mar 2012 Posts: 1
|
Posted: Wed Mar 28, 2012 2:25 pm Post subject: Reading from .txt file |
|
|
| Code: |
set sex "./sex.txt"
bind pub - !sex sex:msg
proc sex:msg {nick uhost hand chan arg} {
global sex
set sexmsg [string range [randomline $sex] 0 end]
puthelp "privmsg $chan :$sexmsg"
}
proc randomline f {
set data [split [read [set file [open $f]]][close $file] \n]
set position [rand [llength $data]]
lindex $data $position
}
|
is there a way this can be modified, so it will keep track of which lines from the sex.txt have been used, and not repeat those until all lines have been used ? |
|