Skip to main content
reskate.throwdowns reads the throwdown the local player is in, hosts drops for chosen players of the session, and holds the throwdown kit: the functions that make a throwdown mode a plugin. Every function, the throwdown event and the throwdown_ui event need the throwdowns permission; calling a function without it raises an error. See permissions.

Reading and hosting drops

reskate.throwdowns.state()

The throwdown the local player is in, if any.
table
Needs the throwdowns permission.

reskate.throwdowns.host(mode, players, options)

Hosts a drop where the local skater stands, shown only to the players you choose. They see it in their game and join it with the game’s own Join; it starts once all of them have joined. The drop spawns over the next moments: follow it with hosting().
string
required
"jam" (a jam session), "spot_battle" or "skate" (S.K.A.T.E.). The game’s own names, "JamSession", "SpotBattle" and "ThrowdownSkate", work too.
table
required
A list of 1 to 7 other players of the session: ids ("7656...") or player tables with an id, as reskate.session.players() gives them. A player listed twice counts once.
table
boolean
True when the drop was asked for.
string
Why not: "one drop every 5 s", "not in a session", "<plugin> is hosting a drop" (another plugin’s drop is being asked for, spawning or open) or "a drop is asked for already".
An unknown mode, a list of no players or more than 7, a player that is not an id, or a max out of range raises an error.
Needs the throwdowns permission. One drop every 5 seconds; a refused call counts too. Reading the session’s players needs session.read.

reskate.throwdowns.hosting()

What became of this plugin’s drop.
string or nil
nil when the plugin has not hosted a drop, or another plugin has hosted one since. Otherwise one of:
  • "asked": asked for; it spawns at the next moment it can.
  • "spawning": being spawned where the skater stood.
  • "open": the chosen players can see it and join it.
  • "started": everyone joined, and it runs.
  • "cancelled": the plugin cancelled it. It stays so until the plugin’s next drop.
  • Why it failed: "the skater is not in the world", "a throwdown or challenge is running", "a chosen player is not in the session", "the throwdown events are not found yet; try again in a moment", "your game is out of linked throwdowns (its speed or mods)", "a plugin's drop is spawning already", "the drop could not be queued", "the drop never spawned", "the drop did not spawn" or "the drop could not be described to the other players".
Needs the throwdowns permission.

reskate.throwdowns.cancel()

Takes this plugin’s drop away, if it has not started yet. A drop that started runs on. Cancelling when the plugin has no drop does nothing. After a cancel, hosting() says "cancelled" (from the next tick) until the plugin hosts another drop. Returns nothing.
Needs the throwdowns permission. When the plugin stops, its drop is cancelled the same way.

The throwdown kit

The throwdown kit makes a throwdown mode a plugin. ReSkate knows no particular mode. Your plugin:
  1. Registers its modes with reskate.throwdowns.mode. Each gets a card on the game’s Throwdowns page.
  2. Publishes documents with reskate.throwdowns.ui: what the player should see. ReSkate draws them with skate.’s own widgets: the setup page, the start flag, the waiting card, the in-game HUD and the match panel.
  3. Hears what the player does as throwdown_ui events, and runs the rules itself.
A mode goes through these steps:
  1. The player clicks your card. ReSkate begins the native flag for the mode and opens Spot Battle’s setup page, relabelled from your setup document. You hear open.
  2. The player changes rows (setup_row, setup_button) and presses Confirm (setup_confirm), or backs out (setup_back).
  3. The player places the start flag with the game’s own placement (flag_placed). Your waiting document becomes the waiting card.
  4. The host presses Start (start). You drop the waiting document and publish your hud. The flag in the world goes; the match is yours to run.
  5. The match ends. You stop publishing the HUD and call reskate.throwdowns.flag.leave().
A plugin’s documents only drive its own modes, and its events only reach it. When the plugin stops, its modes, its documents and its native flag go. For a walkthrough, see game modes.

Registering a mode

reskate.throwdowns.mode(mode)

Puts a mode on the Throwdowns page, or updates it: calling it again with the same id changes that mode. The page shows the stock S.K.A.T.E., Spot Battle and Skate Jam cards (less any a mode replaces), then every plugin’s modes by order.
table
required
boolean
True when the mode is on the page.
string
Why not: "a mode needs an id of 1 to 32 characters, without /", "a mode needs a name of 1 to 32 characters", "a description is at most 240 characters", "players are 1 to 10, min no more than max" or "32 modes are registered already" (by all plugins together).
A card or replaces that is not a stock card, a color or cursor_height out of range, an art or flag over 256 characters, a flag with other characters, or a field of the wrong type raises an error.
Needs the throwdowns permission. The mode’s setup page comes from your setup document, not from this table.

reskate.throwdowns.remove_mode(id)

Takes one of your modes off the page.
string
required
The mode’s id. An id you never registered does nothing.
Returns nothing.
Needs the throwdowns permission. When the plugin stops, all its modes go.

Documents

reskate.throwdowns.ui(doc)

Publishes your plugin’s documents: what the native UI shows for your modes. Each call replaces everything you published before, so a part you leave out shows nothing. Publish whenever something changes; every tick is fine, since an unchanged document costs only a comparison.
table
required
boolean
True when the documents are taken.
string
Why not: "a throwdown document is at most 512 KB as JSON".
A table that cannot become JSON raises an error: one with keys that are neither a list (1 to n) nor strings, a NaN or infinite number, or tables nested deeper than 32. The documents are read leniently:
  • A field that is missing, or of the wrong type, takes its default. A typo blanks a label, not the whole HUD.
  • A text past its limit is cut. Unless a field says otherwise, a text is at most 256 characters. A text may be a number or a boolean; it is shown as Lua prints it.
  • A list past its limit keeps its first items. Some widgets show fewer than a list may hold; each field says so.
  • mode is your mode’s own id ("duel").
  • Colours are 0xAABBGGRR. Times are milliseconds.
  • Positions are world metres: a vector, a list {x, y, z} or a table {x = .., y = .., z = ..}. A component that is not finite, or past 1 000 000, is 0.
  • Steam IDs are strings ("7656..."): a Lua number cannot hold every one exactly.
Needs the throwdowns permission. When the plugin stops, its documents go.

The setup page

setup relabels Spot Battle’s own setup page while the player is on it for one of your modes. Moving a slider or a choice sends setup_row; pressing a button row sends setup_button; Confirm goes on to the start flag.
table

Sliders

players, timer and a "slider" row take the same fields.
table
The page shows whole numbers: min, max and value are rounded, and a step is at least 1. When your document’s value changes, the slider moves to it. The players slider is 1 to 10 players. The native flag takes the timer’s value as its time, kept within 1 to 3600 seconds: a timer of 0 (none) still opens the setup page, and your plugin runs its own clock.
A choice’s value in the document counts from 1, but its setup_row event counts from 0. With the options above, picking "2" sends setup_row with {"laps", "1"}.

The waiting card

waiting is the card shown while the start flag is down and the match has not started. Its Start sends start and its Leave sends leave.
table
Once the flag is placed, the flag lives while you publish this mode’s waiting card or an active hud. Publish one within 15 seconds of flag_placed, or the flag goes and you hear flag_left.

The HUD

hud is the in-game HUD of a running match, built from slots of skate.’s native HUD. Every slot is optional. Only one plugin’s HUD shows at a time. Many slots draw with a widget family named by theme: the widgets UI/ReSkate/Throwdowns/HUD_<theme>_<part>_Widget that your mod’s data brings (Title_<width>, Score, Rank, Name_<width>, Value_<width>, Elapsed, Position_<Medal>, Warning, Logo, Results_<width> and so on). Fields ending in _art name another family for one slot. A slot whose widget is not loaded is left out; the others still draw. The clock, the countdown, the banner, the callout, the card and the markers use skate.’s stock widgets. What shows together:
  • While results is there, it replaces the header, counters, clock, board and every other slot. The intro, countdown and blackout still show.
  • While editor is there, the counters, clock, board, position, timers, card and list are hidden.
  • While blackout is there, the markers are hidden.
table
The other fields are grouped below.
table
The title frame, top left. It shows only with a title.

Counters

table
At most 8 texts (or tables with a text); 4 are shown. A block above the board, or a column under the position medal when position is there.
number
default:"480"
The counters’ width in pixels, 0 to 4096. Beside a position medal it is 480.
string
The counters’ widget family, at most 64 characters. Empty: HUD_<theme>_Score.

Board and results

table
The leaderboard.
table
The results panel, in place of the rest of the HUD. Its rows use the board’s cell families (board.rank_art, name_art, value_art and the rest) and its first two column captions.

Board rows

board.rows and results.rows hold board rows.
table

Clocks

clock, countdown, a row’s clock and a timer’s text or clock take a clock. The HUD ticks a clock itself between your documents, from the moment its numbers were true. A clock comes in two forms. A countdown, or a time counting up to a cap:
table
A stopwatch, an elapsed time counting up. A table with base_ms is one:
table

The match clock and the start

table
The match clock, bottom centre: a clock on skate.’s countdown widget.
table
The 3-2-1 before the start: a clock, shown while it has time left and the intro is not shown. When it reaches zero, GO! shows for 0.9 seconds.
table
The native throwdown intro, in the middle of the screen. While it shows, the countdown waits.
table
The native throwdown banner across the screen.
table
A short word top centre, such as "TRICK SET!".
table
An alert across the screen. It shows while its text is not empty.
A banner or callout shows when it has text and its serial differs from the last one shown. A HUD document without the slot changes nothing: the same serial coming back does not show again. A new match (your HUD going inactive and active again, or another plugin’s HUD) shows the first one whatever its serial. Within a match, add 1 to the serial each time you want it shown.

Card, list, position and timers

table
A card on the left, such as the trick to copy.
table
A boxed list top left, such as tricks already done.
table
The local player’s place, top left.
table
At most 6 timers; the first 2 are shown, top left. Each:
string
The timers’ widget family, at most 64 characters. Empty: HUD_<theme>_Elapsed.

Compass, markers and blackout

table
A point on the native compass strip: its icon sits by the bearing to at, up to 90 degrees either side.
table
At most 32 labels over the world. A label sits 1.5 m above its point, kept on the screen; a point behind the camera has none.
table
A black screen, such as for a seeker while the others hide. Its text takes the place of the header’s status.

Editor

editor is a panel of controls for placing things before a match, such as a route of gates. While a flag waits, an active HUD with an editor keeps the flag alive in place of the waiting card.
table

Prompts

The editor’s prompts and its modal’s actions are prompts. They show input glyphs and a caption; they do not read the input. Read it with reskate.input.
table

The match panel

panel is the native details page the player opens during a match from the Throwdown Panel prompt. It shows while your match runs: while your hud is active or your match asks for something. Opening it sends panel_open; its Quit sends quit.
table

Flags for other players

flags lists start flags for the session’s other players. Each shows on their games as a native flag (a map point, a bubble, a map card and an Enroll card), when they have your plugin and its mode. Their Join reaches your plugin on their game as join.
table
At most 32 flags. Each:

What a match asks of the game

match asks the game for what a running match needs. What every plugin asks is merged: one plugin’s true holds.
table

The native flag

One native flag registration exists at a time, for one plugin mode. It runs from the setup page through the game’s own flag placement to the waiting card, until your plugin starts the match or the owner leaves. Clicking your card begins it with the mode’s default players and opens the setup page, then sends open: you do not need to call flag.begin for that.

reskate.throwdowns.flag.begin(mode, game, options)

Begins the native flag for one of your modes, without the card.
string
required
Your mode’s id.
number
required
Your number for this game: a whole number from 1 to 4294967295. Events about the flag carry it.
table
boolean
True when the registration began, or waits for the last one to finish going. False while another registration is busy (a flag being placed or down), outside a level, or with options out of range.
With setup_page = false while the same mode and game wait on a placed flag, the old flag goes and placement opens again; you do not hear flag_left for the old one. A mode id that is empty, over 32 characters or has /, a game that is not a whole number in range, or an option out of range raises an error.
Needs the throwdowns permission.

reskate.throwdowns.flag.state()

The native flag registration, whoever’s it is.
table
Needs the throwdowns permission.

reskate.throwdowns.flag.leave()

Lets the registration go: you refused it, finished the match or cancelled it. It only acts on a registration of one of your modes. You do not hear flag_left for it. Returns nothing.
Needs the throwdowns permission. When the plugin stops, its registration goes the same way.

The throwdown_ui event

Fires for what the player does in the native throwdowns UI with one of your modes, and for the answers of your dialogs.
string
What happened: see the table.
string
Your mode’s id. Empty for dialog, and may be empty for quit.
table
A list of strings. Read numbers with tonumber.
Events wait in a queue of 64 for each plugin; past that, the oldest go. An event has at most 16 args. Registering a handler needs the throwdowns permission. See events.

Dialogs

reskate.ui.dialog (which needs ui.screen and throwdowns) answers through this event, with action "dialog" and an empty mode:
  • dialog id: the dialog’s id.
  • button: the id of the button pressed; "row" for a list row clicked; a row button’s name; "file" for a file opened; "file_error" when the file could not be read; "cancel" for Esc or B, which also closes the dialog.
  • text: the text field’s text. With "file_error", why: "the file cannot be read" or "the file is larger than 64 KB".
  • row: the list row picked, from 1; "0" for none.
  • file text: the opened file’s text, at most 64 KB; empty otherwise.

The throwdown event

Fired when a throwdown starts or ends for the local player, whoever hosted it.
string
"started" or "ended".
Registering a handler needs the throwdowns permission. See events.
While a throwdown runs, reskate.skater.wipeout and reskate.animation.play are refused, and trick replacements do not play. See skater and animation.