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 name | What it is |
|---|---|
Widgets.Button | Wraps a game button and exposes its button-specific behavior to scripts. |
Widgets.CheckBox | A checkbox widget whose checked state can be changed by the player or a script. |
Widgets.Clickable | Wraps a game widget so scripts can inspect and control it; other widget helpers extend this base. |
Widgets.CyclingButton | A button that displays a selected value and cycles through configured values when pressed. |
Widgets.LockButton | A lock button toggles between locked and unlocked when pressed. |
Widgets.Slider | A JsMacros slider widget with a draggable handle. |
Widgets.TextField | Wraps the game's text field with a text-change callback. |