console, overlay and skater.read permissions.
What you make
A plugin called Speedo. It draws your skater’s speed in the top left of the screen, and adds a console command,speedo, that shows or hides it.
1
Make the mod folder
In the game’s folder, open
Mods and make a folder for the plugin, such as speedo. This folder name is the plugin’s id: plugin list, plugin reload and the log all use it.Use plain ASCII for the name: letters, digits, spaces, _, - and ., not starting with a dot, at most 64 characters.You end up with this layout:2
Write manifest.json
manifest.json is the mod’s own description, the one Thunderstore packages carry. Its name matters to plugins: it is the plugin’s message channel, so the same plugin on every player’s game finds itself under it, whatever its folder is called.3
Write reskate-plugin.json
This file makes the mod a plugin. It names the API version, the entry script, where the plugin runs and the permissions it needs.
consolelets it add a command and print to the console.overlaylets it draw.skater.readlets it read the skater’s speed.
4
Write plugin/main.lua
The entry script runs once when the plugin loads. It registers what the plugin does: here a console command and a A few things to know about this code:
draw handler.reskate.on("draw", ...)runs its handler every tick. The handler getsd, the drawing object, and draws withd:rect,d:textand the rest. Drawing works only inside a draw handler.- Screen positions are vectors,
vector.create(x, y, 0), in pixels from the top left. reskate.skater.get()returnsnilwhen there is no skater, so check for it.reskate.logwrites to ReSkate’s log, not the console.reskate.console.printwrites to the console.
5
Switch it on
A mod folder that
mods.json does not list is on, so a new plugin needs nothing more: ReSkate looks for plugins every 2 seconds, and loads a new one at the next game tick. You do not restart the game.If you switched the mod off earlier, switch it on again in your mod manager.6
Check that it runs
Open ReSkate’s console and run:You see a line like this:Load into a level. The readout shows your speed. Run
speedo in the console to hide it, and again to show it.7
Edit it and watch it reload
Change something in The readout shows the new size. You never restart the game while you work on a plugin.
plugin/main.lua, such as the text size from 26 to 40, and save the file. Within 2 seconds ReSkate notices the change, unloads the plugin and loads it again. The log says:8
Read its errors
Errors go to ReSkate’s log, After more than 5 errors in 10 seconds, ReSkate stops the plugin:
logs/ReSkate.log beside the game (or %LOCALAPPDATA%\ReSkate\logs when that folder cannot be written). The plugin’s own lines (what it logs, its errors, why it stopped) start with its id in brackets.Try it: change skater.speed to skater.sped and save. The draw handler now raises an error each tick, and the log shows each one with where it happened, followed by a traceback:plugin list shows it as stopped (more than 5 errors in 10 s). Fix the line and save: the change loads it again.If the plugin does not show up in
plugin list at all, the mod is off or its folder has no reskate-plugin.json. If it shows as stopped right away, its reason says why: a mistake in the manifest, a missing entry file, or an error as the entry script ran. A mistake in reskate-plugin.json shows in the log as Plugin speedo was not loaded: <why>.Next steps
Events
React to ticks, levels, tricks, bails and players.
Permissions
Find the permission for what you want to do next.
Limits
Learn what stops a plugin, so yours never is.
Overlay
Everything a draw handler can draw.