Docs · store

store

15 store commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

forgetAllSettings
forgetAllSettings()

Clears this script's whole settings file — every saved number, text and flag.

Example
forgetAllSettings()
forgetSetting does something
forgetSetting(key: string)

Removes one saved setting from this script's file.

ParameterTypeWhat it does
keyrequired string the name to remove
Example
forgetSetting("trips")
hasSetting returns bool
hasSetting(key: string) -> bool

Whether this script has saved anything under a name — for telling a fresh run from a resumed one.

ParameterTypeWhat it does
keyrequired string the name to look for
Example
if hasSetting("trips") { print("resuming") }
saveBag does something
saveBag(key: string, bag: bag)

Saves a whole bag into this script's settings file, as JSON — the record partner of saveNumber. Load it back with savedBag. Refuses a bag that holds itself.

ParameterTypeWhat it does
keyrequired string the setting to save under
bagrequired bag the bag to save, written as JSON
Example
saveBag("lastRun", bagOf("hp", 30))
saveFlag does something
saveFlag(key: string, value: bool)

Remembers a yes/no for this script under a name.

ParameterTypeWhat it does
keyrequired string the name to save it under
valuerequired bool the yes/no to remember
Example
saveFlag("finishedSetup", true)
saveNumber does something
saveNumber(key: string, value: int)

Remembers a number for this script under a name, in its settings file. Read it back next run with savedNumber.

ParameterTypeWhat it does
keyrequired string the name to save it under
valuerequired int the number to remember
Example
saveNumber("trips", 42)
saveNumbers does something
saveNumbers(key: string, values: list<int>)

Remembers a whole list of numbers under a name — a seen-list or a route that should outlast a restart. Read it back with savedNumbers.

ParameterTypeWhat it does
keyrequired string the name to save them under
valuesrequired list<int> the numbers to remember
Example
saveNumbers("seen", range(0, 3))
saveText does something
saveText(key: string, value: string)

Remembers a piece of text for this script under a name.

ParameterTypeWhat it does
keyrequired string the name to save it under
valuerequired string the text to remember
Example
saveText("mode", "bank")
saveTexts does something
saveTexts(key: string, values: list<string>)

Remembers a whole list of strings under a name. Read it back with savedTexts.

ParameterTypeWhat it does
keyrequired string the name to save them under
valuesrequired list<string> the strings to remember
Example
saveTexts("names", menuOptions())
savedBag returns bag?
savedBag(key: string) -> bag?

The bag a setting holds, or none when the setting is missing or does not parse — the other half of saveBag, across runs and restarts.

ParameterTypeWhat it does
keyrequired string the setting saveBag wrote
Example
if savedBag("lastRun") == none { print("first run") }
savedFlag returns bool
savedFlag(key: string, fallback: bool) -> bool

The yes/no saved under a name, or the fallback when nothing is saved.

ParameterTypeWhat it does
keyrequired string the name it was saved under
fallbackrequired bool what to use when nothing is saved yet
Example
if savedFlag("finishedSetup", false) { print("resuming") }
savedNumber returns int
savedNumber(key: string, fallback: int) -> int

The number saved under a name, or the fallback on the first run before anything has been saved.

ParameterTypeWhat it does
keyrequired string the name it was saved under
fallbackrequired int what to use when nothing is saved yet
Example
let trips = savedNumber("trips", 0)  print(trips)
savedNumbers returns list<int>
savedNumbers(key: string) -> list<int>

The list of numbers saved under a name, or an empty list when nothing is saved.

ParameterTypeWhat it does
keyrequired string the name they were saved under
Example
print("seen", count(savedNumbers("seen")))
savedText returns string
savedText(key: string, fallback: string) -> string

The text saved under a name, or the fallback when nothing is saved.

ParameterTypeWhat it does
keyrequired string the name it was saved under
fallbackrequired string what to use when nothing is saved yet
Example
if savedText("mode", "off") == "bank" { stop }
savedTexts returns list<string>
savedTexts(key: string) -> list<string>

The list of strings saved under a name, or an empty list when nothing is saved.

ParameterTypeWhat it does
keyrequired string the name they were saved under
Example
print("names", count(savedTexts("names")))