Save Data - SmallSquareStudios/Psych-Engine-Wiki-Extra GitHub Wiki

Saving and Deleting Files

saveFile(path:String, content:String, ?absolute:Bool = false)

Saves a file to a path and adds content, with an option to ignore mod folders.

path - The path you want to save the file to.

content - The content you want to add in the save file. Additionally, you can use setDataFromSave().

absolute - Optional, ignores mod folders.

deleteFile(path:String, ?absolute:Bool = false)

path - The path to the file you want to delete.

absolute - Optional, ignores mod folders.

Directory functions

directoryFileList(folder:String)

Returns a list of files in a folder as a string.

This only works as of 0.7.

Initiating Save Data

initSaveData(name:String, ?folder:String = 'psychenginemods')

Initiates a save file. Useful for setting and getting save data.

name - The name of the file you want to initiate.

folder - Optional, the folder you want to store the save data in.

Getting and Setting Save Data

setDataFromSave(name:String, field:String, value:Dynamic)

Sets data to a save file.

name - The path to the save file.

field - The field you want to set.

value - The value you want to set the field as.

You must use flushSaveData() in order to save files.

getDataFromSave(name:String, field:String, ?defaultValue:Dynamic = null)

Gets data from a save file.

name - The path to the save file.

field - The field you want to get.

defaultValue - Optional, the default value to be retrieved. This is returned if the field doesn't exist or has no value set.

Saving Data

flushSaveData(name:String)

Saves the specified file.

name - The path to the save file.