Save DB
In origin specifically, you can use the save system to store data in the user's account using files that will be stored in the "user/application data" folder.
This is not and will never be supported by the embed system on originOS
Listing save data
log saveContents()
// logs an array of the files in your save dataSetting your save directory
save "myapp@myusername" "set_directory"
// a basic app data directory example
// if you are unable to set your directory because it has already been used, the user will be prompted to allow or deny you access, if the user denys access, your app will be closed, if they allow it, your app will execute the rest of your code.Create/Set a save file
This command will create the file if it doesn't exist, and update its value if the file does exist
Append data
This command appends data to a save file, the file must exist for this command to work
this command when run on our file data.txt would update it's value to:
Append a new line
This command appends data on a new line to a save file, the file must exist for this command to work
this command when run on our file data.txt would update it's value to:
Getting data from your save
Using the .saveGet() method, you can get the value of a save file.
Checking if a save file exists
You can easily check if a file exists using the .saveExists() method, it returns a boolean of if a save file exists
Last updated
Was this helpful?