Hey,
I'm trying to write a float to a file and then read it (loading and saving), and it works fine if I save, create a new map, then open without closing the editor (its for a world editor), but for some reason if I exit the program then get back into it and try to load it, it won't read the variable it stored. Let me make sure I'm right, "write float 1,x" will write that variable to a file, correct? then "read float 1,x" will read the value of that variable in the file, right? So why won't it load it when I get back in? Is this a bug or am I doing something wrong? Heres my save map code
gosub readinput
if filename$>"" and entered>1
entered=0
open to write 1,"saved/"+filename$+".popr"
inc saved,1
if saved>0
filename$=""
endif
if sprite exist(15)=0
toolbar(15,4,480,300,"SaveMap")
endif
show sprite 15
for checknumberofobjects=1 to numberofobjectstotest
if object exist(checknumberofobjects)=1
numberofcubes=checknumberofobjects
endif
if object exist(1)=0
numberofcubes=0
endif
next checknumberofobjects
write float 1,numberofcubes
wait promptdelaytime
hide sprite 15
endif
And heres my load code
gosub readinput
if filename$>"" and entered>1
entered=0
`if file exist(filename$)=1
`if sprite exist(16)=0
toolbar(16,4,480,300,"LoadMap")
`endif
show sprite 16
if file open(1)=0
open to read 1,"saved/"+filename$+".popr"
endif
filename$=""
read float 1,numberofcubes
if numberofcubes=0
for NoSaveDeleteObject=1 to numberofobjectstotest
if object exist(NoSaveDeleteObject)=1
delete object NoSaveDeleteObject
endif
next NoSaveDeleteObject
endif
if numberofcubes>0
if object exist(numberofcubes)=0
for cubecount=1 to numberofcubes
make object cube cubecount,1
next cubecount
endif
endif
hide sprite 16
wait promptdelaytime
`endif
Any help is appreciated, thanks.
Pirates of Port Royale:
http://www.popr.gwgaming.net (Temporarily Disabled, We Apologize for the Inconvenience)
Live the life.