mIRC Homepage

$read suggestion/example needed

Posted By: Jesper

$read suggestion/example needed - 12/05/03 11:27 AM

How do I make $read read the last lines of a txt file?
like. I know how to get the last, but how to get the last 10 or 5 for that matter?


I need it in a alias event that echos the results to me.
eg.

alias readnews
;usage /readnews (number of lines to read but max 10)
echo -a .... this is where you can help me smile
Posted By: ScatMan

Re: $read suggestion/example needed - 12/05/03 11:43 AM

two ways
first u can use loadbuf: /loadbuf NUMBER-OF-LINES WINDOW file.txt
and the second:
alias readnews {
if ($1 <= 10) {
var %i = $calc($lines(file.txt) - $1 +1)
while (%i <= $lines(file.txt)) {
echo -a $read(file.txt,%i)
inc %i
}
}
}
Posted By: Jesper

Re: $read suggestion/example needed - 12/05/03 12:12 PM

uuh Scatman, "readnews 1" reads 2 lines, "readnews 2" reads 3 lines.. etc etc frown
Posted By: ScatMan

Re: $read suggestion/example needed - 12/05/03 02:42 PM

i'd edited my command, check the new one
Posted By: Jesper

Re: $read suggestion/example needed - 12/05/03 03:09 PM

Many thanks smile
© 2022 mIRC Discussion Forums