Hello!
I made a script that shows me a line of a textfile. For example with "!showline 2" my bot shows the second line of the file. But how can I find out if this line exists, e.g. if the file only has one line?
proc count:lines {file} {
if {![llength $file]} return
set lines 0
set f [open $file r]
while {[gets $f foo]>-1} {
incr lines
}
close $f
return $lines
}
Not tested but should work.
Once the game is over, the king and the pawn go back in the same box.
well, I assume when the script can post a specific line, it probably uses an '[lindex $listoflines [expr {$arg + 1}]]' statement. To check in such a case, a simple