Saving State
by Nelson A. K. Gonsalves · in Torque Game Engine · 10/02/2001 (12:47 pm) · 4 replies
How would I go about saving all the player vars and info to a file using the script language?
About the author
#2
10/03/2001 (12:14 pm)
You also might look into export()
#3
10/03/2001 (1:36 pm)
out of curiosity if the program crashes and you dont' use $file.close(); does the data stay saved or is it gone?
#4
10/04/2001 (8:52 pm)
Most of the data is probably cached in the filestream and not flushed, you'd probably lose some of it. The input logging, which is crash proof (somewhat), manually flushes the stream after every write to make sure the OS write's it out. There is currently no facility for this on the FileObject, something you could add though :)
Torque Owner Tim Gift
$file = new FileObject(); $file.openForWrite("mod/filename"); $file.writeLine($player.name); $file.close(); $file.delete();There are also openForRead,openForAppend, readLine and isEof methods.