EDIT:
I have solved this. Read the last post for the answer. This is not readily apparent to newbs. Spent way too much time on this. Perhaps, update in the help files that ReadLine will continue to read the next line if the file is open. That would have solved hours of frustration.
No idea why I can't get any command to read the lines in this file.
I have tried readline and readstring. I have seterror(mode) =2.
File content
Floor:1:0.000000:0.040000:-4.000000:-0.000000:0.000000:0.000000:
Fire Pit:0:0.000000:0.040000:-4.000000:-0.000000:0.000000:0.000000:
Floor:1:1.000000:0.040000:-4.000000:-0.000000:0.000000:0.000000:
Wall:1:1.000000:0.040000:-3.500000:-0.000000:0.000000:0.000000:
Wall:1:1.000000:0.040000:-4.500000:-0.000000:0.000000:0.000000:
Garden:0:2.000000:0.040000:-7.000000:-0.000000:0.000000:0.000000:
Read file
OpenToRead( 1, "home_area_save.txt" )
objdata$ = ReadLine( 1 )
CloseFile( 1 )
token_count = CountStringTokens( objdata$, ":" )
file_lines = token_count/8
h as Home_Objects
for i = 0 to file_lines-1
h.desc = GetStringToken( objdata$, ":",(i*8)+1)
level = Val(GetStringToken( objdata$, ":",(i*8)+2))
x# = ValFloat(GetStringToken( objdata$, ":",(i*8)+3))
y# = ValFloat(GetStringToken( objdata$, ":",(i*8)+4))
z# = ValFloat(GetStringToken( objdata$, ":",(i*8)+5))
rotx# = ValFloat(GetStringToken( objdata$, ":",(i*8)+6))
roty# = ValFloat(GetStringToken( objdata$, ":",(i*8)+7))
rotz# = ValFloat(GetStringToken( objdata$, ":",(i*8)+8)
....... etc
Only the first line is returned so token_count = 8
Code to write to file
if house_construction.length > 0
for i = 0 to house_construction.length
WriteLine( home_area_save, house_construction[i].desc +":" +str(house_construction[i].level) +":" +str(GetObjectX( house_construction[i].ID ) ) +":" +str(GetObjectY( house_construction[i].ID ) )+":" +str(GetObjectZ( house_construction[i].ID ) ) +":" +str( GetObjectAngleX( house_construction[i].ID ) ) +":" +str( GetObjectAngleY( house_construction[i].ID ) ) +":" +str( GetObjectAngleZ( house_construction[i].ID ) ) )
next i
endif
Not sure what I am doing wrong here. I have tried both line and string commands. Only getting the first line read.