if ($1 == !last) {
var %last = $2
if (%last isnum) {
var %lines = $lines(learnt.txt)
var %i = $calc(%lines - %last +1)
var %result
while (%i <= %lines) {
var %line = $read(learnt.txt,%i)
var %islocation = $findtok(%line,=>,1,32)
var %keyword = $gettok(%line,1- $+ $calc(%islocation -1),32)
if (%result) { %result = %result $+ , %keyword }
else { %result = %keyword }
inc %i
}
msg $chan Results: %result
}
else { msg $chan no number specified }
}
The above will seem familiar to the !listall except all it does is start on a particular line
.
I'll explain some:
var %last = $2
create a temporary variable for %last which is a number you provide after "!last"
var %i = $calc(%lines - %last +1)
create a temporary variable taking the total %lines minus the %last (the number you provide this gets us the remaining lines) and add 1 to it. Adding one shifts it down 1 line, to start on the line we want to begin at.