I wrote this some time back with a little help here on the forums i want to change it slightly
Currently I have to type !next line number in pm with the bot id like to get it so I only have to type !next and it will output the next line of text
Code: Select all
set out_chan "#Trainingroom"
set txt_file "training.txt"
bind msg SA|SA !next next_proc
bind msg SA|SA !back back_proc
proc tr_proc { nick uhost hand arg } {
global out_chan txt_file
set line [lindex [split $arg] 0]
if {$line == ""} {
putserv "PRIVMSG $chan :Usage: !next <line number>"
return
}
set take_me [open $txt_file r]
set take_all [split [read $take_me] "\n"]
close $take_me
set data [lindex $take_all [expr $line - 1]]
putquick "PRIVMSG $out_chan :$data"
}
proc back_proc { nick uhost hand arg } {
global out_chan txt_file
set line [lindex [split $arg] 0]
if {$line == ""} {
putserv "PRIVMSG $chan :Usage: !back <line number>"
return
}
set take_me [open $txt_file r]
set take_all [split [read $take_me] "\n"]
close $take_me
set data [lindex $take_all [expr $line - 1]]
putquick "PRIVMSG $out_chan :$data"
}