Skip to content

Tweaks

Tweaks a plugin lists with the project’s own, and switching any tweak by name.

cancel(): void

Fine to call twice, or from inside one.

Get it with Api.tweaks().

add(definition: import("salamander").Given<Wraith.Tweaks.Definition>, handler: Wraith.Tweaks.Handler): void
addIn(section: string, definition: import("salamander").Given<Wraith.Tweaks.Definition>, handler: Wraith.Tweaks.Handler): void
remove(id: string): void
addHook(section: string, definition: import("salamander").Given<Wraith.Tweaks.Definition>, hook: Wraith.Hook | null): void
addOpener(section: string, definition: import("salamander").Given<Wraith.Tweaks.Definition>, window: Wraith.Window | null): void
isOn(name: string): boolean
setOn(name: string, on: boolean): void
onSwitched(handler: Wraith.Tweaks.Switched): Wraith.Tweaks.SwitchSubscription

Until removed or the plugin goes. The same id replaces it and keeps it on.

Fails with TweakError. Uses Tweaks.Definition, Tweaks.Handler.

Like add, under a heading like Combat. Empty is none.

Fails with TweakError. Uses Tweaks.Definition, Tweaks.Handler.

Waits for its handler if it’s running, unless called from inside it.

A toggle that enables hook while on. The definition’s mode and fields are ignored.

Fails with TweakError. Uses Tweaks.Definition, Hook.

An open button that opens and focuses window.

Fails with TweakError. Uses Tweaks.Definition, Window.

Whether a tweak’s box is on, by saved name. A group’s own box, not its contents. Any thread.

Fails with TweakError.

Switches it next frame, like clicking its box. Fine from inside any handler.

Fails with TweakError.

Hears every tweak go on or off. Gone with the plugin.

Fails with TweakError. Uses Tweaks.Switched, Tweaks.SwitchSubscription.

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

Code Error
1 InvalidId Empty, too long, or not letters, digits, _, - and .
2 InvalidDefinition A key that isn’t one, or a field with no name
3 NotFound No tweak or group’s saved by that name
4 Failed

An enum of u8.

Value Name
0 toggle On until it’s turned off
1 action Runs once, then everything it did goes back
2 open An action that opens something, like a window. Shown with an open button.

An enum of u8.

Value Name
0 f64
1 f32
2 i64
3 i32
4 i16
5 i8
6 u64
7 u32
8 u16
9 u8
10 bool

A struct, 0x18 bytes, aligned to 8.

Offset Field Type
0x0 value f64
0x8 label string
value: number
label: string

Like a tweak’s @data, but no memory: changes go to the handler.

A struct, 0x70 bytes, aligned to 8.

Offset Field Type
0x0 name string
0x10 type Tweaks.FieldType
0x18 value f64
0x20 label string Empty shows the name
0x30 toggle bool A checkbox for 0 and 1
0x31 hex bool
0x32 has_min bool Limits, each only with its has_
0x38 min f64
0x40 has_max bool
0x48 max f64
0x50 key string Flips a toggle, like F9. Empty is none.
0x60 choices []Tweaks.Choice A dropdown
name: string
type: Wraith.Tweaks.FieldType | Wraith.Tweaks.FieldTypeName
value: number
label: string
toggle: boolean
hex: boolean
has_min: boolean
min: number
has_max: boolean
max: number
key: string
choices: Array<Wraith.Tweaks.Choice>

A struct, 0x48 bytes, aligned to 8.

Offset Field Type
0x0 id string Kept with the user’s settings
0x10 title string Empty shows the id.
0x20 key string Like Ctrl+F8. Empty is none.
0x30 mode Tweaks.Mode
0x38 fields []Tweaks.Field
id: string
title: string
key: string
mode: Wraith.Tweaks.Mode | Wraith.Tweaks.ModeName
fields: Array<Wraith.Tweaks.Field>

An enum of u8.

Value Name
0 on Turned on, or an action run. Each field comes as a changed just before.
1 off
2 changed A field’s value, before on or when it changes while on

A struct, 0x20 bytes, aligned to 8.

Offset Field Type
0x0 kind Tweaks.EventKind
0x8 field string For changed
0x18 value f64
kind: Wraith.Tweaks.EventKind | Wraith.Tweaks.EventKindName
field: string
value: number

On the render thread. Failing an on keeps it off and shows the error (a script’s throw).

Wraith.Tweaks.Handler

A tweak went on or off, by saved name like kai/Combat/Max bravery. Render thread, after the frame it changed.

Wraith.Tweaks.Switched

Made with ♥ by Asgard