hi med, I dont get the if statement you are using .. and you have no CLOSE FILE statement. If you only call the function to open and read files, I think you can skip the if-clause. you might want to add a condition to check the file was opened correctly and respond if not - but that's a different matter.
I think the following should work ok for you ..
EDIT: you aren't closing your save file either .. the process is - open file to [operation] #filenumber, #filepath - do operation - close file #filenumber -
function LoadGame()
filename$= "C:\darkbasic\mymedia\Savegame.dat"
if not file exist(filename$)then error_handler("open file - no file found")
open to read 1,filename$
read float 1,x#
read float 1,y#
read float 1,z#
read float 1,ax#
read float 1,ay#
read float 1,az#
close file 1
position object 2,x#,y#,z#
xrotate object 2,ax#
yrotate object 2,ay#
zrotate object 2,az#
endfunction
function error_handler(S$)
print S$
wait key
end
endfunction
if effort>reward : gosub home : endif