Hello again im having trouble reading from a flat file on my shell.
Well i can read it but i cant display its contents in channel.
It's based on a quote script by Koloth, v1.0. i altered it so people could add quake servers to it for people to play on. and remove them if they are down. it currently displays how many servers are added and it will pull a random server (Was a random quote) from the list with !server (which used to be !quote) so everything works fine. now instead of having a random server displayed on channel id like it to reel off the entire list. can someone give me an example of how display a document on channel. I have already opened the file, read the contents and closed it again.
Thanks in advance.
^DooM^
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
^DooM^ wrote:Hello again im having trouble reading from a flat file on my shell.
Well i can read it but i cant display its contents in channel.
It's based on a quote script by Koloth, v1.0. i altered it so people could add quake servers to it for people to play on. and remove them if they are down. it currently displays how many servers are added and it will pull a random server (Was a random quote) from the list with !server (which used to be !quote) so everything works fine. now instead of having a random server displayed on channel id like it to reel off the entire list. can someone give me an example of how display a document on channel. I have already opened the file, read the contents and closed it again.
Thanks in advance.
^DooM^
if you have read the contents into a variable, then it is a simple matter of regular variable manipulation...
foreach line [split $your_data_variable \n] {
puthelp "PRIVMSG $chan :$line"
}
(or if you've already created a _list_ from the file):
foreach element $your_data_list {
puthelp "PRIVMSG $chan :$element"
}
im sure im doing it right but i get this error now.
[23:17] Tcl error [qot_all]: can't read "qot_list": variable is array
any ideas?
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
proc qot_all {nick uhost hand chan rest} {
global qot
if {![file exists $qot(file)]} {
putchan $chan "Error: No Servers found or database does not exist"
return
}
set qot_fd [open $qot(file) r]
for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {
gets $qot_fd qot_list($qot_cnt)
}
close $qot_fd
set qot_cnt [expr $qot_cnt - 2]
unset qot_list([expr $qot_cnt + 1])
if {![info exists qot_list([expr $rest - 1])]} {
putchan $chan "Error: that server does not exist"
return
} else {
foreach line [split $qot_list \n] {
putchan $chan "[expr $qot_cnt + 1] Servers in total"
putchan "PRIVMSG $chan :$line"
return
}
}
}
Thanks strikelight
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born