TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
Setting API lets you define player-facing controls that appear in the built-in Settings dialog and persist across sessions via browser storage. Each setting you register adds a corresponding property to the global settings object, which you can read anywhere in your story to branch logic or adjust behavior.
The settings object
Every setting registered with the Setting API automatically adds a property to the global settings object. You can read current values from it anywhere in your story:
You can write directly to
settings properties (e.g. settings.theme = "dark"), but doing so bypasses Setting.save(). Always call Setting.save() manually afterwards, or use Setting.setValue() which calls it for you.Registering settings
Setting.addHeader(name [, desc])
Adds a visual section header to the Settings dialog. Headers do not create a settings property.
The header’s display text.
Optional description rendered below the header. May contain markup.
Setting.addToggle(name, definition)
Adds a boolean on/off toggle to the Settings dialog and registers settings[name] as a boolean.
The
settings property name.Definition object — see below.
Label displayed next to the toggle control.
Additional description shown below the label. May contain markup.
Default value. Defaults to
false when omitted.Called once during initialization with a result object as the sole argument and as
this.Called whenever the control value changes with a result object as the sole argument and as
this.Setting.addList(name, definition)
Adds a drop-down list to the Settings dialog and registers settings[name] as the selected member value.
The
settings property name.Definition object — see below.
Label displayed above or beside the list control.
The array of option values. Each member is both a display label and the stored value.
Additional description. May contain markup.
Default value. Must equal one of the
list members. Defaults to the first member when omitted.Called once during initialization with a result object.
Called whenever the selected option changes.
Setting.addRange(name, definition)
Adds a numeric range slider to the Settings dialog and registers settings[name] as a number.
The
settings property name.Definition object — see below.
Label displayed next to the slider.
Minimum value.
Maximum value.
Increment size. Must divide evenly into
max - min.Additional description. May contain markup.
Default value. Defaults to
max when omitted.Called once during initialization.
Called whenever the slider value changes.
Setting.addValue(name [, definition])
Registers a settings property without adding a visible control to the Settings dialog. Useful for behind-the-scenes values that should persist across sessions.
The
settings property name.Optional definition object — see below.
Default value. No type restriction.
Called once during initialization with a result object.
Called whenever the value changes via
Setting.setValue().Result objects
TheonInit and onChange callbacks receive a result object as both their sole argument and as this. Its shape mirrors the definition but reflects the current live values:
| Property | Type | Present for |
|---|---|---|
name | string | All types |
value | any | All types |
default | any | All types |
list | Array<string> | List only |
min | number | Range only |
max | number | Range only |
step | number | Range only |
Reading and writing values
Setting.getValue(name) → any
Returns the current value of the named setting. Equivalent to settings[name].
The
settings property name.Setting.setValue(name, value)
Sets the named setting to a new value and automatically calls Setting.save().
The
settings property name.The new value for the setting.
Persistence
Setting.load()
Loads the settings from storage and applies defaults for any missing properties. Called automatically at startup — you should rarely need to call this manually.
Setting.save()
Saves the current state of the settings object to storage.
The Settings dialog controls and
Setting.setValue() call this automatically. Only call it manually when you write directly to settings properties.Setting.reset([name])
Resets a single setting — or all settings — to their default values.
Name of the setting to reset. When omitted, all settings are reset.