Scripting
Custom UI
Native panels, buttons and popups created and owned by your script.
fn on_new_game(ctx) {
// this.panel() is your own helper that returns a node tree.
[#{op: "ui", widget: #{
id: "panel",
tree: this.panel(),
actions: #{"Body/Button": "on_click"},
modal: true
}}]
}
fn on_click(ctx) {
[#{op: "cash", amount: 500}, #{op: "remove_ui", id: "panel"}]
}
The tree format
Widgets use the same name / active / rect / comps / children
shape as the game's exported UI. Text, images, buttons, masks, anchoring and layout groups render through the native
UI renderer.
- Rect coordinates are in a 3840 × 2160 reference canvas with Y up; anchors adapt to the viewport.
- Bind paths relative to the widget root to your own one-argument functions. An empty path binds the root itself.
- Your action callback receives
ctx, can changethis, update its UI and return game commands. - Send the same widget
idagain to replace it;remove_uiremoves it. - The topmost modal widget owns input. Native OK popups block the UI and map underneath.
- Trees rebuild only when they change.
| Limit | Value |
|---|---|
| Active widgets | 64 |
| Nodes per widget | 128 |
| Tree depth | 12 levels |
| Action bindings | 32 |
Note
Runtime UI targets in-match overlays. To change existing frontend pages, use menu edits; arbitrary new frontend screens are still pending.