Goal
Write a number to Save State, then read it during a new Play session. This is independent of a character, Actor or attached Module.
1. Create the standalone script
Create scripts/visits.aeo with:
const visits = save.get("visits")
if visits == nil {
save.set("visits", 1)
} else {
save.set("visits", visits + 1)
}
save.commit()
debug.log("Visits:", save.get("visits"))
2. Test persistence
Save and enter Play. Inspect Output for the first stored count. Stop Play, then start Play again. The number should increase because save.commit() persists the supported value.
Screenshot 26: assets/docs/tutorials/26-save-state-output.png — counts in separate Play sessions.
3. Know what is saved
Save State holds typed values separately from authored World and scripts. This implementation supports numbers, booleans and strings in a project-specific default slot. save.set changes the in-memory value; save.commit() writes it. Do not store Actor handles, Baskets or Maps as values.
Checkpoint
Starting Play again increments the count without altering a Block in the authored World. On failure, check Output for a commit error rather than assuming disk writes succeeded.
Next: Save guide and Save API.