Skip to content

Settings

Settings a plugin registers, which Wraith stores and lists under the plugin in its Settings.

get(): Wraith.Setting.Value
set(value: import("salamander").Given<Wraith.Setting.Value>): void
remove(): void

Text is good till this setting’s next get().

Fails with SettingError. Uses Setting.Value.

Saved, like picking it in Settings. Numbers get clamped.

Fails with SettingError. Uses Setting.Value.

Gone from Settings. Its saved value stays.

Get it with Api.settings().

add(definition: import("salamander").Given<Wraith.Setting.Definition>, changed: Wraith.Setting.Changed | null): Wraith.Setting

Gone with the plugin.

Fails with SettingError. Uses Setting.Definition, Setting.Changed, Setting.

A struct, 0x10 bytes, aligned to 4.

Offset Field Type
0x0 r f32
0x4 g f32
0x8 b f32
0xc a f32
r: number
g: number
b: number
a: number

What can go wrong, besides Cancelled, Unsupported and Gone.

Code Error
1 Unavailable
2 InvalidDefinition
3 InvalidId
4 AlreadyAdded
5 InvalidValue
6 Failed

A path is a folder or file, picked or typed

An enum of u8.

Value Name
0 toggle
1 number
2 choice
3 text
4 colour
5 path

Where a value’s kept: for every game, or just this one.

An enum of u8.

Value Name
0 global
1 game

Only the setting’s kind’s field means anything. Choices and paths are text.

A struct, 0x30 bytes, aligned to 8.

Offset Field Type
0x0 toggle bool
0x8 number f64
0x10 text string
0x20 colour Colour
toggle: boolean
number: number
text: string
colour: Wraith.Colour

A struct, 0xc8 bytes, aligned to 8.

Offset Field Type
0x0 id string Unique for the plugin. Letters, digits, _, - and ..
0x10 name string Defaults to the id
0x20 help string
0x30 section string A heading in the plugin’s part of Settings
0x40 scope Setting.Scope Where it starts; the player can switch it in Settings
0x41 restart bool Only takes effect next time the game starts
0x42 kind Setting.Kind
0x43 has_default bool Without one it’s the kind’s zero: false, min, the first option, “” or white
0x48 default_value Setting.Value
0x78 min f64 For numbers. 1 or more steps whole numbers.
0x80 max f64
0x88 step f64
0x90 options []string For choices
0xa0 file bool For paths: a file, not a folder
0xa8 extension string For a file, like “.json”
0xb8 placeholder string For paths: what’s used while empty
id: string
name: string
help: string
section: string
scope: Wraith.Setting.Scope | Wraith.Setting.ScopeName
restart: boolean
kind: Wraith.Setting.Kind | Wraith.Setting.KindName
has_default: boolean
default_value: Wraith.Setting.Value
min: number
max: number
step: number
options: Array<string>
file: boolean
extension: string
placeholder: string

After its value changes, on the thread that changed it (render thread from Settings).

Wraith.Setting.Changed

Made with ♥ by Asgard