Skip to main content
This page lists every event reskate.on accepts. Five need no permission; each of the others needs the permission named in its section.

Handling an event

reskate.on(event, handler)

Registers a function to run each time the event fires. Register handlers when the entry file runs, usually at its top level.
string
required
The event’s name, one of the 33 on this page, or the same name from reskate.Enums.Event.
function
required
Called with the event’s arguments, described in each section below.
It returns nothing. These raise a Lua error:
  • an unknown name: there is no event "<name>" in this ReSkate;
  • an event the plugin lacks the permission for: the <name> event needs the "<permission>" permission in reskate-plugin.json;
  • more than 256 handlers for one event: more than 256 handlers for one event.
A handler stays registered until the plugin unloads; there is no way to remove one. Keep a flag and return early instead. A handler call past 50 ms is logged as a warning and one past 1000 ms stops the plugin (see limits). An error in a handler is logged and counts towards the plugin’s error limit.

Order in a tick

On a player’s game, each tick hands out the trick events first, then the session’s players, messages, events from other plugins, web answers, and the game’s events (skater, bails, physics steps, grind exits, chat, music, throwdowns, binds). After them come each plugin’s timers and tick handlers, then its draw handlers, then its screen and its menu page and panels. Level events come as the game notices a level change.

Client and server copies

The trick events reach only a plugin’s client copy. The level events reach a client copy and a dedicated server’s server copy, which hears them when the server changes its map. A server copy on a dedicated server has no skater, so it hears no skater, physics, chat or music events either. See client and server copies.

Events with no permission

load

Permission: none. Fires once, after the entry file has run, each time the plugin loads (and reloads). The handler gets no arguments.

unload

Permission: none. Fires when the plugin unloads while it runs: its mod switched off or removed, its files changed, plugin off, or plugin reload. The handler gets no arguments. All unload handlers share 20 ms; the rest are skipped once it is spent.
unload does not fire when a plugin is stopped over a limit, nor when the game closes. Storage is saved every 2 seconds and when a plugin stops, so you need no unload handler to keep it.

tick

Permission: none. Fires every game tick, after the plugin’s due timers.
number
Milliseconds since the last tick (0 on the first).

level_loaded

Permission: none. Fires when a level is being played that was not before.
string
The level’s name, as reskate.level.current().name gives it.
A plugin that loads while a level is already up does not hear level_loaded for it. Read reskate.level.current() in a load handler too.
On a dedicated server, a server copy hears it when the server changes its map (the console’s map, a map vote or the rotation), as soon as the server has changed it: players’ games load the map after.

level_unloading

Permission: none. Fires when the level being played changes or goes away, before level_loaded for the next one.
string
The name of the level being left.
On a dedicated server, a server copy hears it when the server changes its map. Anything the plugin had going on the old map, such as a round or a spawned park, ends there.

Tricks

trick_started

Permission: events.tricks. Fires when the local skater starts a trick, as the score HUD shows it.
vector
Where the skater was when the trick began.

trick_landed

Permission: events.tricks. Fires when a trick lands and its points show in the line’s score.
number
The trick’s points, at the multiplier it raised the line to.
number
That multiplier.
vector
Where it began.
vector
Where the skater was when it landed.
number
Milliseconds from its start to its landing.
string
The trick the score HUD named last, such as "Kickflip". May be empty.

line_broken

Permission: events.tricks. Fires once when a fall loses the line going on: a slam, a wipeout, a ragdoll, or a runout (a failed landing on foot). It fires for a line that has points banked as well as for a trick going on, and once per fall, however long the fall lasts. Stepping off the board is not a fall.
string
"slam" for a slam, "wipeout" for every other fall.

trick_notes

Permission: events.tricks. Fires once a tick while the trick feed is on and skate.’s score HUD wrote to its trick list since the last tick. Any plugin turns the feed on with reskate.tricks.feed(true); every plugin with events.tricks and a handler hears it.
table
A list of notes, oldest first. At most 256 wait between two ticks; more are dropped.
The HUD can write a field again for the same entry: keep the latest.

The skater

skater_state

Permission: events.skater. Fires when the local skater’s state changes, checked every tick.
string
The new state: "riding", "air", "wipeout", "grinding", "off_board", "planted", "other" or "none" (no skater).
string
The state before, from the same list.
reskate.skater.state() reads the same value at any time.

bail

Permission: events.skater. Fires when the local skater wipes out: when its count of wipeouts this session goes up.
number
How many wipeouts the skater has had this session.
number
The slam’s force. Only present when the game recorded a slam in the last second.
number
The game’s number for the slam’s cause. Present with force.
vector
Where the skater is. Absent without a skater.

board_landed

Permission: events.skater. Fires when the board comes down from the air, read in the physics step where it happens.
number
How fast it was coming down, in metres per second.
number
How fast it was going along, in metres per second.
string
"rail" or "ground".

body_hit

Permission: events.skater. Fires during a bail when part of the skater’s body hits something hard enough to be heard: 3 metres per second or more along the contact. Feet never count. A bone fires at most once every 220 ms, and the body at most once every 70 ms.
string
The body part, such as "Head", "Left forearm", "Right shin" or "Pelvis".
number
The hit’s speed along the contact, in metres per second.
boolean
Whether it hit a vehicle.
boolean
Whether it hit the board.
The body parts are Head, Neck, Left hand, Left forearm, Left upper arm, Left collarbone, Right hand, Right forearm, Right upper arm, Right collarbone, Upper chest, Chest, Lower back, Spine, Left shin, Left thigh, Right shin, Right thigh and Pelvis.

bail_end

Permission: events.skater. Fires once a bail’s fall is over: when the body is up again, or 3 seconds after the fall began. It sums up what the body went through.
number
How long the fall lasted.
number
The impacts of the left arm and leg, summed (metres per second).
number
The impacts of the right arm and leg, summed.
table
The body parts that hit or slid, by name. Each is a table with impact (its impacts summed, metres per second) and slide (how far it slid, in metres). Names are those of body_hit, plus the feet and toes.

launch

Permission: events.skater. Fires for each launch of the local skater into the air: ollies, pops out of grinds, no complies and boneless, as the game made them and as they left after any plugin’s reskate.skater.shape_launch. Launches are followed from the first tick a plugin with events.skater runs, and at most 32 wait between two ticks.
string
What it came out of: "grind", "ollie", "no_comply", "boneless" or "other".
vector
The velocity it left with, in metres per second.
vector
The velocity the game gave it, before any shape.
vector or nil
The direction of travel before it, level and one long. nil under 0.5 metres per second.
number
The speed of that travel, in metres per second.
boolean
Whether a plugin’s shape changed it.
string
"applied" (shaped), "none" (no plugin shapes these launches), "slow" (too slow to tell the direction of travel) or "not_ours" (it did not go along its travel at about the skater’s speed, so across and along were left alone).
string or nil
The id of the plugin whose shape changed it.

Physics

physics_step

Permission: events.physics. Fires for every physics step of the local skater, in order: several times a tick. The steps are kept from the first tick a plugin with events.physics runs, and at most the last 512 wait between two ticks. During slow motion (reskate.time.slow) more steps come each second, each of them shorter.
number
When the step was read, in milliseconds on the clock of reskate.time.now.
number
How long the step simulated, in seconds of game time.
boolean
Whether the step asks for a wipeout.
boolean
Whether the skater is in the air, on the board or off it.
boolean
Whether the body is a ragdoll. Absent when the skater’s state could not be read.
table
How the skater moves, in metres per second: with the board while on it, else as its pelvis. A list of three numbers, {x, y, z}, not a vector. Absent when unknown.
number
How fast the pelvis turns, any way round, in radians per second. Absent when unknown.
table
The body parts touching something in this step, by name. Each is a table with impact (its hardest contact’s speed along the contact, metres per second), slide (that contact’s speed along the surface, metres per second), and the booleans board, vehicle and world (anything but the board and vehicles: the ground, walls, rails). Bodies only touch things while the ragdoll moves them, in a bail; riding or walking, the table is empty. Names are those of body_hit, plus Left toes, Left foot, Right toes and Right foot.

Physics geometry

Permission: events.physics.geometry, which also needs events.physics in the same manifest. A manifest with the first and not the second fails to load: events.physics.geometry also needs the events.physics permission. With it, each physics_step carries the skater’s bodies as they are in the world, for effects that start where a body hits something. Without it these fields are never there. A field ReSkate could not read is absent, never zero, so do not make a hit out of a missing one.
number
A number for the skater’s physics state in this step, as the game selects it. It names no game memory. Compare it between steps to see a change; it has no fixed meaning to rely on. Absent when it could not be read.
table
Where the body’s hardest contact in the step is, in the world: {x, y, z}, metres. Absent when unknown.
table
The surface’s normal at that contact, in the world: {x, y, z}. Absent when unknown.
table
Every body of the local skater ReSkate could read, by name, airborne ones included, and whether or not it touches anything. Each is a table with transform, a list of 16 numbers, and velocity, {x, y, z} in metres per second. The transform is the body’s place in the world as four rows of four: the body’s x, y and z axes in the first three rows, its position in the first three numbers of the fourth (transform[13], transform[14], transform[15]). Empty when none could be read.
A handler runs for every step, many times a second, so keep it short: count and keep what you need, and draw or log from a tick or draw handler. Each call is timed as usual (a warning past 50 ms, stopped past 1000 ms), and they add up towards the plugin’s time limits.

Drawing

draw

Permission: overlay. Fires every tick, after the tick handlers, to draw this frame’s shapes. The handler gets the drawing object, and drawing works only inside it. What it draws replaces what it drew the frame before. A server copy’s drawing is never shown.
table
The drawing object: d:text, d:rect, d:line, d:circle, d:poly, d:gradient, d:world_text, d:world_line, d:world_circle, d:image, d:world_image, d:game_image, d:skeleton, d:size and d:world_to_screen. See overlay.

Multiplayer

player_joined

Permission: session.read. Fires for each player who comes into the session. When you join or start one, it fires for every player already in it, you included. The game checks the session four times a second.
string
Their SteamID64, as a string.
string
Their name.
boolean
Whether it is you.
boolean
Whether they host the lobby (never on a dedicated server).
boolean
Whether it is the session’s authority. Always false here.

player_left

Permission: session.read. Fires for each player who leaves. When you leave the session, it fires for every player in it, you included. The handler gets the same player table as player_joined.

touch

Permission: session.skaters. Fires when your skater comes within reach of another player’s, while your plugin has touching on (reskate.session.touch). It fires once a contact: again only after the two were apart. Bodies are compared every tick.
string
The player’s id.
string
The part of your skater nearest theirs: "head", "body", "left_arm", "right_arm", "left_leg", "right_leg" or "board".
string
The part of their skater nearest yours.
number
The gap between those parts, in metres: 0 where they overlap.
vector
The point halfway across that gap, in the world.

touch_end

Permission: session.skaters. Fires when the two are apart again: 10 cm further apart than the reach, or the player has gone (left, or is no longer drawn). The handler gets the same fields as touch, as the two were at that moment (when the player has gone, as they last touched).

message

Permission: net.session. Fires when the same plugin on another game sends you a message with reskate.net.send: one addressed to everyone, or to you. A server copy hears those addressed to everyone or to "server".
table
Who sent it, as a player table (id, name, me, host, server). For a message from the session’s authority (a server copy), server is true, and name is "Server" when the session has no name for the sender.
string
What was sent. A buffer arrives as a string of its bytes.
The session says who sent a message; a plugin cannot pretend to be another player or the authority. Only a server copy’s messages arrive with from.server set.

chat

Permission: chat.read. Fires for each new line in your chat, as you see it (filtered when you filter chat). Lines from before the first plugin listened are not delivered. At most 20 lines a tick are; older ones past that are dropped. Lines plugins add with reskate.chat.notice (tagged “Plugin”) are never delivered, to the plugin that added them or to any other, so an echo cannot loop.
string
The sender’s SteamID64, as a string; "0" for a notice from ReSkate itself.
string
The sender’s name.
string
The line, as your chat shows it (masked when your chat filter caught something).
boolean
Whether you sent it.
boolean
Whether a dedicated server said it itself (its console, its welcome or its answers).
On a dedicated server, a server copy hears every player’s line as the server passes it on, unfiltered, and the server’s own lines to everyone (sender "0", server true), its plugins’ say lines among them. It also hears a /command the server does not know itself, such as /race join, with its /. The server does not answer such a line Unknown command while a plugin hears chat, so your plugin answers the player, with reskate.server.tell. The server’s own commands (/help, /vote, /kick and the rest) never reach plugins.

poll_answer

Permission: server. Fires in a dedicated server’s server copy when a player answers one of the plugin’s polls. The poll closes for that player; no poll_closed follows.
number
The poll’s id, as reskate.server.poll gave it.
string
The player’s SteamID64, as a string.
number
Which answer, from 1.
string
The answer’s text.

poll_closed

Permission: server. Fires in a dedicated server’s server copy when one of the plugin’s polls closes for a player who did not answer it.
number
The poll’s id.
string
The player’s SteamID64, as a string.
string
"timeout" (it ran out), "left" (the player left the server), "replaced" (a newer plugin poll for that player) or "closed" (reskate.server.poll_close).

throwdown

Permission: throwdowns. Fires when a throwdown starts or ends for you.
string
"started" or "ended".

throwdown_ui

Permission: throwdowns. Fires for what you do in the native throwdowns UI with one of the plugin’s modes (registered with reskate.throwdowns.mode): its card, setup page, start flag, waiting card and match panel. It also brings the answers of the plugin’s reskate.ui.dialog dialogs. At most 64 events wait for each plugin; past that, the oldest go.
string
What happened, such as "open", "setup_row", "flag_placed", "start", "quit", "join", "panel_command" or "dialog".
string
The mode’s own id. Empty for dialog, and may be empty for quit.
table
A list of at most 16 strings.
See the throwdown_ui event for every action and its args.

Input and screens

action

Permission: input. Fires once for each press of a combo the plugin bound with reskate.input.bind, while the game itself has the input (no menu, console or text box open). When the player set their own combo for the action on the Binds page, theirs is the one that fires it.
string
The action’s name, as given to reskate.input.bind.

camera_cycle

Permission: camera. Fires when the game’s camera height button steps into or out of your plugin’s camera, while it is in the cycle with reskate.camera.cycle. Start or stop your camera then.
string
"enter" (start your camera) or "leave" (stop it; the game’s high camera comes back).

screen_closed

Permission: ui.screen. Fires when the player closes the plugin’s open full-screen screen with Esc. It does not fire when the plugin closes it with reskate.ui.close.
string
The title of the screen that closed.

The menu

favorites_changed

Permission: menu. Fires when the player’s starred items change: an item starred or unstarred in the game’s item grids, or the starred items read for the first time after the plugin started. It is checked once a tick. The handler gets no arguments: read the set again with reskate.menu.favorites, a table of item keys, each true. What the set was when ReSkate first looked is not a change. A plugin that starts after the starred items were read hears nothing until the next change, so read them when it loads too.
Permission: menu. Fires when what is up over the game changes: the game’s pause menu, ReSkate’s menu or the replay editor coming up or going, the ReSkate page the pause menu shows, or whether the game’s screens could be read (known). It is checked once a tick, and fires once for each change.
table
What is up now, as reskate.menu.state gives it: known, pause, reskate, replay_editor and page.
table
What was up before, in the same form.
What was up when ReSkate first looked is not a change. A plugin that starts while a menu is up hears nothing until the next change, so read reskate.menu.state() when it loads.

Music

track_changed

Permission: music. Fires when the song in your outside music player (Spotify and the like) changes. It is checked once a second.
string
The player it comes from.
string
The song’s title.
string
Its artist.
boolean
Whether it is playing.
The event has no album; reskate.music.current() gives it.