SplitScript reference / setVariable

setVariable

Function

setVariable<T>(name: String, value: T) -> None where T: Display

Sets a custom variable in the timer runtime.

The value is visible to layouts that display autosplitter variables in both debug and release builds. It is intended for meaningful end-user-facing information displayed on the speedrun timer. Use inspect instead for temporary source-labelled developer debugging that is published only in debug builds, or print for a chronological diagnostic log.

Parameters

  • name: The variable name.
  • value: The displayed value. It is converted to text using the same rules as string interpolation.

Effects: writes timer state

Runtime behavior: available everywhere; synchronous

Examples

Expose a layout variable

setVariable("Points", 42)