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.
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().
"jam" (a jam session), "spot_battle" or "skate" (S.K.A.T.E.). The game’s own names, "JamSession", "SpotBattle" and "ThrowdownSkate", work too.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.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".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.
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:- Registers its modes with
reskate.throwdowns.mode. Each gets a card on the game’s Throwdowns page. - 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. - Hears what the player does as
throwdown_uievents, and runs the rules itself.
- The player clicks your card. ReSkate begins the native flag for the mode and opens Spot Battle’s setup page, relabelled from your
setupdocument. You hearopen. - The player changes rows (
setup_row,setup_button) and presses Confirm (setup_confirm), or backs out (setup_back). - The player places the start flag with the game’s own placement (
flag_placed). Yourwaitingdocument becomes the waiting card. - The host presses Start (
start). You drop thewaitingdocument and publish yourhud. The flag in the world goes; the match is yours to run. - The match ends. You stop publishing the HUD and call
reskate.throwdowns.flag.leave().
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.
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).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.
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.
- 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.
modeis your mode’s ownid("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.
Sliders
players, timer and a "slider" row take the same fields.
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.
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.
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
resultsis there, it replaces the header, counters, clock, board and every other slot. The intro, countdown and blackout still show. - While
editoris there, the counters, clock, board, position, timers, card and list are hidden. - While
blackoutis there, the markers are hidden.
Header
Counters
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.Board and results
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.
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:
A stopwatch, an elapsed time counting up. A table with base_ms is one:
The match clock and the start
The match clock, bottom centre: a clock on skate.’s countdown widget.
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.Banner, callout and warning
A banner or callout shows when it has text and itsserial 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
Compass, markers and blackout
A point on the native compass strip: its icon sits by the bearing to
at, up to 90 degrees either side.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.
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.
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 withreskate.input.
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.
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.
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.
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 sendsopen: 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.
Your number for this game: a whole number from 1 to 4294967295. Events about the flag carry it.
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.
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.
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.
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.
throwdowns permission. See events.