Quote: " I can't scan through that file until FileEOF says I've got to the last line. If I could do that, I could use the natural length of the subimages.txt file to ascertain the correct/real number of tiles."
You can, the subimages file must be in the same folder as the image and you know the image name so simply append "subimages.txt" to the end, open the file and count the lines.
Function CountSubImages(imagefile as string)
file=OpenToRead(imagefile+" subimages.txt")
count=0
while FileEOF(file) = 0
ReadLine(file)
inc count, 1
endwhile
CloseFile(file)
EndFunction count
or by id
Function CountSubImages(id as integer)
if GetImageExists(id)
imagefile$=GetImageFilename(id)
file=OpenToRead(imagefile$+" subimages.txt")
count=0
while FileEOF(file) = 0
ReadLine(file)
inc count, 1
endwhile
CloseFile(file)
endif
EndFunction count