Skip to content

Widgets ​

Lets scripts identify buttons, sliders, and other widget helpers through the Widgets global.

js
const screen = Hud.getOpenScreen();  
if (screen !== null) {
 for (const widget of screen.getButtonWidgets()) {
   if (widget instanceof Widgets.Slider) {
     Chat.log(widget.getValue());  
   }
 }
}

These names are available in JavaScript and Python without importing anything. They are read-only aliases of Java types, so instanceof works as usual.

Script nameWhat it is
Widgets.ButtonWraps a game button and exposes its button-specific behavior to scripts.
Widgets.CheckBoxA checkbox widget whose checked state can be changed by the player or a script.
Widgets.ClickableWraps a game widget so scripts can inspect and control it; other widget helpers extend this base.
Widgets.CyclingButtonA button that displays a selected value and cycles through configured values when pressed.
Widgets.LockButtonA lock button toggles between locked and unlocked when pressed.
Widgets.SliderA JsMacros slider widget with a draggable handle.
Widgets.TextFieldWraps the game's text field with a text-change callback.