Skip to main content
A plugin shows controls to the player in two places: its own page in the PLUGINS section of ReSkate’s menu (reskate.menu.page and reskate.menu.panel, which need the menu permission), and full-screen screens it opens itself (reskate.ui.screen, which needs ui.screen). Both are built from the same widgets. To ask the player for a name, a pick from a list or a file, open a dialog (reskate.ui.dialog). For short notices, see reskate.ui.toast. A plugin’s server copy shows neither.

The PLUGINS section

Each plugin with a page gets its own place in the menu, under its page’s title. In a window, the menu’s side rail has a PLUGINS group with one row per plugin. Full screen, a PLUGINS tab at the top has a tab per plugin. Both list the plugins by name. The section only shows while some plugin has a page. A plugin’s page is what reskate.menu.page builds, with the plugin’s panels (reskate.menu.panel) as cards under it. A plugin with panels and no page gets a page named after its id, holding just the panels.

How pages work

You give a page a function that builds it. ReSkate calls that function ten times a second while the menu shows your page, with a builder, ui, and your function calls ui’s widget functions in order, top to bottom. Nothing is kept from one build to the next: build the whole page each time, from your plugin’s own variables. While the menu shows another plugin’s page, or is closed, yours is not built at all. When the player uses a widget, what they did comes back in the next build: the widget’s function returns the new value instead of the one you passed. Keep it in your variable, and pass it the next time.

reskate.menu.page(title, build)

Gives your plugin its page in the PLUGINS section.
string
required
1 to 24 characters. It is the page’s name in the section, and a widget’s actions are matched to the page by it.
function
required
Called with ui each time the page is built.
Needs menu. A plugin has one page: a second call raises an error. So do an empty or too long title, a title one of your panels has, and a build that is not a function. A page holds at most 160 widgets in one build. Each build is timed like any handler: a warning past 50 ms, stopped past 1000 ms (see limits).

reskate.menu.panel(title, build)

Adds a panel to your plugin’s page: a card titled with your title, under what the page builds. Panels are built with the page, only while the menu shows it.
string
required
1 to 40 characters, different from your plugin’s other panels and from its page’s title. A widget’s actions are matched to its panel by this title.
function
required
Called with ui each time the panel is built.
Needs menu. Raises an error for an empty or too long title, a title this plugin used already for a panel or its page, a build that is not a function, and more than 8 panels. A panel holds at most 64 widgets.

Layout

Every widget function is called on ui with a colon, only inside a page’s, a panel’s or a screen’s build function: called anywhere else, it raises an error.

ui:card(title, subtitle)

A titled tile, the kind the menu’s own pages are built from. The widgets after it go in it, until the next card or the end of the build. Widgets before the first card sit on the page itself. A panel is a card already; a card inside it starts a new one.
string
required
At most 60 characters.
string
A line under the title, at most 120 characters.

ui:section(id, title, subtitle, open)

A card the player can fold away. The widgets after it go in it, until the next card or section, as a card’s do. The player opens and folds it; your open only says how it starts.
string
required
1 to 32 characters, as other widgets’ ids. The section remembers whether it is open by its id.
string
required
At most 60 characters.
string
A line under the title, at most 120 characters.
boolean
default:"true"
Whether it starts open. false starts it folded.
boolean
Whether it is open now: what the player did, when they opened or folded it since the last build; otherwise open.
A folded section’s widgets are not drawn. Build them only when it returns true: that keeps a long page cheap, and its widgets out of the 160.

ui:tabs(id, names, chosen)

A row of tabs on the page. Build the chosen tab’s widgets after it: a page builds only the tab shown, so its 160 widgets are counted for that tab alone.
string
required
1 to 32 characters, as other widgets’ ids.
table
required
A list of 1 to 8 names, each at most 24 characters.
integer
default:"1"
The number of the tab shown, from 1.
integer
The tab the player picked, when they picked one since the last build; otherwise chosen. Always 1 to the number of names.

ui:heading(text)

A section heading inside a card.
string
required
At most 300 characters.

ui:label(text)

A line of text, wrapped to the card’s width.
string
required
At most 300 characters.

ui:note(text)

Muted help text, for what the setting above it does.
string
required
At most 300 characters.

ui:warn(text)

A warning, for something the player has to fix or know.
string
required
At most 300 characters.

ui:info(label, value)

A status line: a muted label, and its value beside it.
string
required
At most 60 characters.
string
required
At most 200 characters.

ui:separator()

A horizontal line between widgets.

Controls

Widgets the player can use (tabs, section, button, buttons, toggle, slider, stepper, dropdown, list, text, colour) take an id: 1 to 32 characters, different from the other widgets’ ids in the same build of the page or panel. The id is how the player’s action finds its widget, so keep it the same from one build to the next.

ui:button(id, text, primary)

A button.
string
required
1 to 32 characters.
string
required
Its label, at most 60 characters.
boolean
default:"false"
True draws it as the card’s main action.
boolean
true in the build after the player pressed it, otherwise false.

ui:toggle(id, text, on, help)

A switch, on or off.
string
required
1 to 32 characters.
string
required
Its label, at most 60 characters.
boolean
default:"false"
Whether it shows on.
string
What it does, at most 300 characters, shown with it.
boolean
What the player set it to, when they changed it since the last build; otherwise on.

ui:slider(id, text, value, minimum, maximum, format)

A slider between two numbers.
string
required
1 to 32 characters.
string
required
Its label, at most 60 characters.
number
required
Its value now.
number
required
The left end.
number
required
The right end, above minimum.
string
default:"\"%.2f\""
How the value shows on the slider, at most 24 characters: exactly one %f (or %.Nf, N a single digit) or %d, among plain text, with %% for a percent sign. For example "%d%%", "%.1f m" or "x%.2f". Anything else raises an error.
number
What the player set, when they moved it since the last build; otherwise value. Always between minimum and maximum.
%d shows the value rounded, but the value that comes back is not: round it yourself, as above, when you want whole numbers.

ui:dropdown(id, text, choices, chosen, help)

A list to pick one from.
string
required
1 to 32 characters.
string
required
Its label, at most 60 characters.
table
required
A list of 1 to 32 strings, each at most 60 characters.
integer
default:"1"
The number of the choice shown, from 1.
string
What it does, at most 300 characters, shown with it.
integer
The number of the choice the player picked, when they picked one since the last build; otherwise chosen. Always 1 to the number of choices.

ui:buttons(id, names, lit)

A row of small buttons side by side, wrapping onto more rows as the card runs out of width. It suits a short row of choices, such as a preset or a mode, where a dropdown would hide them.
string
required
1 to 32 characters.
table
required
A list of 1 to 32 names, each at most 40 characters.
integer
The number of the button drawn as the one in use, from 1. Leave it out, or give a number that is not one of the buttons, for none.
integer or nil
The number of the button the player pressed since the last build, or nil.
Pressing a button does not light it. Your plugin decides which one is lit: keep the number that comes back and pass it as lit next time.

ui:text(id, label, value, hint)

A line the player types in.
string
required
1 to 32 characters.
string
required
At most 60 characters.
string
default:"\"\""
What the line holds, at most 200 characters.
string
Shown in the line while it is empty, at most 120 characters.
string
What the line holds now: what the player typed, when they typed since the last build (at most 200 characters); otherwise value.

ui:colour(id, label, colour)

A colour to pick. ui:color is the same function.
string
required
1 to 32 characters.
string
required
At most 60 characters.
table
required
{r, g, b} or {r = , g = , b = }, each 0 to 1. A number past 0 or 1 is held to it; one that is not finite raises an error.
table
The colour now, always as {r = , g = , b = }, each 0 to 1: what the player picked, when they picked one since the last build; otherwise colour.

ui:stepper(id, label, value, minimum, maximum, step, format)

A number that goes up and down by step. In a window it has - and + buttons with the value between them, which the player can also type; full screen, left and right step it.
string
required
1 to 32 characters.
string
required
At most 60 characters.
number
required
Its value now.
number
required
The lowest it goes.
number
required
The highest it goes, above minimum.
number
required
How much one press changes it: above 0, and no more than maximum - minimum.
string
default:"\"%.2f\""
How the value shows, the same as ui:slider’s format. %d shows it rounded.
number
The value now, between minimum and maximum and on a step from minimum: what the player set, when they changed it since the last build; otherwise value, put on the nearest step.

ui:list(id, label, items, chosen, rows)

One item to pick from a long list. In a window, rows of it are in view at once and the rest scroll; full screen, each item is a row of the page. Use it where a dropdown’s 32 choices are too few: tracks, spots, saved runs.
string
required
1 to 32 characters.
string
required
At most 60 characters.
table
required
A list of 1 to 200 strings, each at most 80 characters.
integer
default:"0"
The number of the item shown as chosen, from 1, or 0 for none.
integer
default:"6"
How many rows are in view in a window, 3 to 12.
integer
The number of the item the player picked, when they picked one since the last build; otherwise chosen. 0 for none, and for a number that is not one of the items.

ui:bar(text, value, minimum, maximum)

A gauge the player cannot change: a progress bar with a label on it.
string
required
Its label, at most 60 characters.
number
required
Where it is, kept between minimum and maximum.
number
required
Empty.
number
required
Full, above minimum.
A widget raises an error outside a build function, past 160 widgets in a page’s build or 64 in a panel’s, for an id that is empty, longer than 32 characters or used twice in the build, for text over its length, for a maximum that is not above minimum, for a number that is not finite (or is beyond a million either way), for a dropdown with no choices or more than 32, for tabs with no names or more than 8, for buttons with no names or more than 32, for a list with no items, more than 200 or a rows outside 3 to 12, for a stepper whose step is not above 0 or is wider than its range, for a colour that is not three finite numbers, and for a slider or stepper format that is not exactly one number.

A whole page

The grind-exits plugin (contrib/plugins/grind-exits/plugin/main.lua in the ReSkate repository) builds its page from cards, help text, a slider format, a warning and status lines. Shortened:
The fpv-drone plugin (contrib/plugins/fpv-drone/plugin/page.lua) puts five tabs on its page, each with cards of its own.

Full-screen screens

A screen covers the whole game window, over everything, with your title at the top and the input while it shows. The player closes it with Esc. Use one for a mode’s lobby, a results table, or anything the player should look at before playing on.

reskate.ui.screen(title, build, options)

Adds a screen. It is built ten times a second while it is open, whether or not a menu is.
string
required
1 to 40 characters, different from your plugin’s other screens. It is shown at the top, with your plugin’s id and “Esc closes it” under it.
function
required
Called with ui each time the screen is built. It takes the same widgets as a page, drawn plainly: a card is a heading with its subtitle under it, and tabs are a row of names to pick from.
table
Needs ui.screen. Raises an error for a title that is empty or longer than 40 characters, a title this plugin used already, a build that is not a function, more than 4 screens, a dock that is not "left" or "right", a width out of range, and panel = false with a dock.

reskate.ui.open(title)

Opens one of your screens. A plugin has one screen open at a time: opening another replaces it.
string
required
A screen’s title.
Needs ui.screen. Raises an error for a title you added no screen for.

reskate.ui.close()

Closes your open screen, if one is open. Closing it this way does not fire screen_closed.
Needs ui.screen.

The screen_closed event

Fires when the player closes your screen with Esc, with the screen’s title. It needs ui.screen. See events.
While your screen is open, it has the player’s input: the game behind it does not get the keys. Close it when you are done with it, and let Esc close it.

The character room

The character room of the game menu’s Skaters page: a plain, lit studio under every map, where the game shows the skater while you dress him. reskate.room takes the game there and shows your own skater in it: for a tool that poses, animates or dresses the skater, or a photo booth.
  • open walks the game’s menu there the way the player would: it opens the menu, goes from page to page to the Skaters page, and waits for the room’s skater to show. It takes a moment or two; read state each tick.
  • Once there, your skater is drawn on the room’s floor, facing as the room’s own skater does, and the room’s skater and board are hidden. Your skater stays where it was in the world, and that is where other players see it. Clips, poses and reskate.skater.joint follow the skater as drawn, in the room.
  • The menu’s own pages are still there: hide them with reskate.hud.hide(true), and keep the input from them with a screen of your own. Point the camera at the skater with reskate.camera.set.
  • leave walks back: the game’s menu closes, the room’s skater and board come back, and your skater is drawn where it is again.

reskate.room.open()

boolean
True when the walk there started (or goes on already).
string
"<plugin> has the character room" while another plugin has it, or "not while a throwdown runs".
Needs the room permission. One plugin has the room at a time. When your plugin stops, it leaves the room.

reskate.room.state()

string
"idle", "opening" (the walk goes on), "open" (your skater shows in the room), "leaving" (the walk back goes on) or "failed".
string
For "failed", why, as a sentence: such as "The character room did not open: the Skaters page did not open.". A walk fails when it takes more than 30 seconds, when the game’s menu is not found or does not open, or when the map changes under it.
Needs the room permission. Another plugin’s room reads as "idle", or "leaving" while it walks back.

reskate.room.leave()

Walks the game back to the world, and draws your skater where it is again. Leaving a room your plugin does not have does nothing. Returns nothing.
Needs the room permission.

reskate.room.pose(subject)

Where the game’s menu draws its own board or skater, in the world: for a plugin that draws something beside the menu’s board, or lines a camera up on the skater. It only reads, and takes nothing from the room: it needs no open.
string
default:"\"board\""
"board" (the board’s deck) or "skater" (the skater’s place).
table or nil
nil while the game’s menu is closed, or when the menu has not drawn that rig in its room in the last quarter of a second.
ReSkate watches the menu’s rigs only while a plugin asks: each call keeps it watching for half a second more. So the first call returns nil; call it every tick while you want the pose. Only the rigs the menu draws in its room are read, never the skater and board you play with.
Needs the room permission. A subject that is not "board" or "skater" raises an error.

reskate.room.turn(value, stick)

Turns what the game’s menu shows on its stick: the board on the Board screen, the skater on the Skaters page. It works as a player turning it on a controller would. It holds a stick of a stand-in pad over at value for 300 ms, with the rest of the pad at rest. Call it each tick to keep turning, and with 0 to let go. It needs no character room, and no controller: the stand-in pad works without one. While it holds, the game reads the stand-in pad in place of the first controller, so the player’s own pad does nothing. A walk to the character room comes first.
number
required
How far over the stick is held, -1 to 1. 0 lets go.
string
default:"\"right_x\""
"left_x", "left_y", "right_x" or "right_y".
boolean
True when the stick is held, or let go.
string
With false: "the game's menu is not open". Letting go always works.
A value outside -1 to 1, or another stick, raises an error.
Needs the room permission.

The game menu

What the game’s own menu shows, for a plugin that does something on one of its screens. Fit Check uses it to tell the Board screen from the Skaters page when V is pressed. reskate.menu.state says which menus are up over the game, ReSkate’s and the replay editor included.

reskate.menu.game()

table
Needs the menu permission.

reskate.menu.state()

What is up over the game: the game’s pause menu, ReSkate’s menu and the replay editor. For a plugin that hides its own HUD while one of them is up, say. The menu_changed event says when this changes. Takes no arguments.
table
Needs the menu permission, for the function and the event. Like menu.game(), it says what ReSkate saw, not what stays true, and it gives your plugin no hold on the player’s input.

reskate.menu.grid()

The item grid that has the focus in the game’s customization menu: the Apparel, Accessories, Board, Tattoos, Gestures or Appearance grids.
table or nil
nil when no item grid has the focus.
Needs the menu permission.

reskate.menu.grid_show(keys)

Shows your own list of items in the item grid that has the focus, in place of its tiles: a tab of the player’s own, say. The items come from every item grid of the screen, so a list can hold tops, bottoms and shoes together (the game keeps every grid of a screen, one for each of its tabs). ReSkate’s search still narrows it. The grid’s own tiles come back with nil, and when your plugin stops.
table
Items’ keys, as grid().items and grid().focused give them, in the order to show them: at most 4000, each at most 255 characters. An item no grid of the screen has is left out, and an item twice shows once. nil gives the grid back.
boolean
True when your list shows (or the grid is given back).
string
With false: "<plugin> shows its list" while another plugin’s list shows.
A list that is not a table of strings, or is too long, raises an error.
Needs the menu permission. One plugin’s list shows at a time. Only the grid that has the focus shows it: the game’s tabs still step to the others, so keep their keys from the game while yours shows (game_keys, game_buttons). The game’s equip button still equips the highlighted item.

reskate.menu.grid_mark(keys)

Puts the game’s check mark on these items’ tiles, where a tile shows its rarity icon: items your plugin has done something with, such as the items worn on top. A check wins over a favorite’s star.
table
Items’ keys, at most 4000. nil or {} takes your marks off.
Returns nothing. Each call replaces your list; every plugin’s marks show together.
Needs the menu permission. The game’s check is drawn from what its menus have loaded; where none is, the tiles show no check. Your marks go when your plugin stops.

reskate.menu.favorites()

The items the player starred in the game’s item grids.
table or nil
A set of item keys: each starred key maps to true. An empty table is a set that was read and holds nothing. nil until the player’s favorites are read this run.
string
With nil: why, "not loaded".
The favorites_changed event fires when the set changes, with no arguments. It also fires when the set is first read while your plugin runs. A plugin that starts after the set was read hears nothing until it changes, so call favorites() as it starts.
Needs the menu permission, for the function and the event.

Dialogs

A dialog is a box in the middle of the screen, over the game, that asks the player something: a name to save under, a row to pick from a list, a file to load. It can have a title, a message, a text field, a list of rows with buttons of their own, a row of buttons and a file button: each only if you give it. While it is open it has the player’s input. reskate.ui.dialog needs both ui.screen and throwdowns: what the player does comes to your plugin as throwdown_ui events. Open dialogs from your client copy: a dedicated server has none, and dialog returns false, "unavailable here" there. One dialog is open at a time, over the whole game. While one plugin’s dialog is open, another plugin’s is refused.

reskate.ui.dialog(id, dialog)

Opens a dialog, or updates your open one when the id is the same.
string
required
1 to 32 characters. Every answer carries it.
table
required
Every field is optional.
boolean
True when the dialog is open.
string
"<plugin>'s dialog is open" while another plugin’s dialog is open.
Calling dialog again with the id of your open dialog updates it in place. It keeps what the player typed, unless you pass a different field.text than last time. It keeps the row they picked, unless the list no longer has it. A different id replaces your open dialog with a new one.
Needs the ui.screen and throwdowns permissions. At most 120 calls a second; past that, a call raises an error. An id that is empty or longer than 32 characters, text over its length, a max out of 1 to 256, more than 64 rows, more than 4 buttons on a row or along the bottom, a button with no label, or a filter with other characters raises an error.

reskate.ui.close_dialog(id)

Closes your dialog. It sends no answer.
string
default:"any of yours"
Close it only when it is the dialog with this id. At most 32 characters.
Returns nothing. When your dialog is not open, it does nothing.
Needs the ui.screen permission. When your plugin stops, its dialog closes.

Answers

Each time the player does something in the dialog, your plugin gets a throwdown_ui event with action "dialog", mode "" and five strings in args: What the player did, in [2]:
  • A bottom button’s id: they pressed it. Pressing Enter in the field answers as the first bottom button, when there is one.
  • "row": they picked a row.
  • One of a row’s button names: they pressed it on that row.
  • "file": they picked a file with the file button, at most 64 KB. When they close the picker without picking one, no answer comes.
  • "file_error": the file they picked was not read: [3] is "the file is larger than 64 KB" or "the file cannot be read".
  • "cancel": they pressed Esc, or B on a gamepad. This closes the dialog.
Only "cancel" closes the dialog. After any other answer it stays open until you update it, replace it or close it.

Values for your mod’s own UI

A mod can ship its own game UI (a widget built in ReSkate Studio) that reads numbers your plugin sends: where a controller overlay sits and how wide it is, say. reskate.ui.values sends them, and the widget reads each one through a float DataPath whose SourceContext is that value’s symbol. A value only ever reaches your own mod’s UI. Its symbol is a hash of your mod’s folder name and the value’s name, so a plugin cannot write another mod’s values or any of the game’s own, and never gets a handle or pointer into the game’s UI.
The symbol includes your mod’s installed folder name. Build your UI assets with the same folder name players install, such as Author-ModName. If the folder is renamed, the symbols change and the UI stops getting your values, without any error.

reskate.ui.symbol(name)

The symbol of one of your values, for building your UI assets.
string
required
1 to 48 ASCII letters, digits, _ and -.
number
A whole number from 0 to 4294967295: the djb2 hash (start at 5381, then for each byte multiply by 33 and xor the byte, modulo 2^32) of ReSkate.Plugin.<your mod's folder>.<name>.

reskate.ui.values(values)

Sends values to your mod’s UI.
table
required
Names and numbers, such as {left = 100, top = 165, width = 620}. Names as symbol takes them; each number finite and within ±100000. At most 32 in one call.
boolean
true when they were sent.
string
Why not: "unavailable here" while the game’s UI is not up yet (try again later), "UI value limit reached", "UI symbol collision" or "UI symbol collision or reserved symbol" when a name’s symbol is another’s, or "UI symbol already belongs to another model" when the game’s UI uses it already.
  • Updates merge. A call changes only the names it gives; the others keep their last values. An empty table does nothing.
  • Send what changed, not every tick. Sending the same value again costs nothing, but there is no need.
  • Not all or nothing. When the game’s UI refuses one value, the ones before it in that call may have been sent. Send the whole layout again.
  • Names are kept for the session. Each name you use counts toward your 32 for as long as the game runs, even after your plugin reloads, because the game’s UI keeps them. All plugins together have 256. A name is still counted when the game refused it.
  • When your plugin stops, each value it sent is set to 0. Build your UI to treat 0 (a width of 0, a visibility of 0) as off.
  • A name whose symbol happens to match one of the game’s own UI symbols that has not loaded yet cannot be told apart in advance: the game may later take it over.
Needs the ui.models permission, in a client copy: a server copy gets false, "ui.models is client-only" from values and an error from symbol. A dedicated server has no game UI. A name that is not 1 to 48 letters, digits, _ and -, a number that is not finite or is beyond ±100000, a value that is not a number, more than 32 values in one call, or a values that is not a table raises an error.