Skip to main content
reskate.capture records an area of the screen, frame by frame, as the game draws it. It can cut each frame out from the backdrop behind it, and save the frames you pick as an animation or a still. Fit Check uses it to spin the board or the skater in the game’s menu and save one turn of it. Every function needs the capture permission. reskate.capture.save needs files too: it writes into your plugin’s data folder. A dedicated server has no screen. There start and save return false with "unavailable here".

How it works

  • What is in a frame. Each frame is taken before ReSkate’s overlay draws. Your plugin’s drawing, toasts, ReSkate’s menu and the banner you draw while recording are never in it. The game’s own menus and HUD are.
  • One capture at a time. One plugin records at a time. While another plugin’s capture records or saves, start returns false. A capture another plugin has finished is let go when you start yours.
  • Numbers. Frames are numbered from 1, in the order they are taken, after the frames skip lets go.
  • Thumbnails. Every frame taken has a small grey thumbnail of the area, 24 by 48. compare reads them, so you can tell how far something has turned, or whether it has stopped.
  • Kept pictures. At most 480 pictures are kept at once, and at most 1000 MB of them. Past either limit, every other kept picture is let go, and from then on only every other frame taken is kept. kept says which frames still have their pictures. height keeps each picture smaller, so more fit.
  • The end. A capture stops by itself after frames frames, or after seconds seconds. Its state is then "stopped". Call discard when you are done with it: its pictures are held until you do.

Cutting out

Each frame can be cut out from its backdrop in two ways:
  • By depth. Where the game has a depth for the frame, what is nearer than the backdrop behind it is kept. The backdrop’s distance in each row is that of the area’s left and right edges, so leave a little backdrop at both sides of what you record. The game’s UI is never in the depth.
  • By colour. Where there is no depth, or when you ask for it, the backdrop is keyed out by its colour across all the frames you save.
Then, by either way, only what moved over the frames is kept: the biggest moving piece, and any piece centred within it. Anything that stays the same in every frame, such as a prompt of the game’s menu, is cleared. The picture is cut to a square around what is kept, with a small margin. A single frame cut by depth has nothing that moves, so the depth alone says what is kept.

reskate.capture.start(options)

Starts recording. Calling it again while your capture records starts it over.
table
boolean
True when it started.
string
With false: "<plugin> is capturing" while another plugin’s capture records or saves, "a capture is being saved", or "asked more than 4 times in a second".
A value out of its range raises an error.
Needs the capture permission. At most 4 calls a second, a budget shared with the plugin’s other control calls (skater.noclip, boost, freeze, camera.follow, ai.spawn, animation.play, board.toss, outfit.set).

reskate.capture.stop()

Stops recording. What was kept stays, for save. Stopping a capture that is not yours, or one that is not recording, does nothing. Returns nothing.
Needs the capture permission.

reskate.capture.discard()

Lets go of your capture: everything it kept. Its state is "idle" again. While it saves, the save goes on, and this does nothing. When your plugin stops, its capture is discarded. Returns nothing.
Needs the capture permission.

reskate.capture.state()

How your capture is going. Another plugin’s capture reads as "idle".
table
Needs the capture permission.

reskate.capture.compare(a, b)

How unlike two frames taken look: the mean difference of their grey thumbnails, from 0 for the same to 255. Every frame taken has a thumbnail, kept or not.
number
required
A frame’s number, a whole number from 1.
number
required
Another frame’s number.
number or nil
0 to 255, or nil when either frame has not been taken, or there is no capture of yours.
A number that is not a whole number from 1 to 20000 raises an error.
Needs the capture permission.

reskate.capture.kept()

The numbers of the frames whose pictures are kept, in order.
table
A list of frame numbers. Empty when there is no capture of yours.
Needs the capture permission.

reskate.capture.save(path, options)

Saves frames of your capture to a file in your data folder. It stops the recording first. The file is written on its own thread: state reads "saving", then "saved" or "failed". The pictures stay after saving, so you can save the same capture again, in another format for example, until you discard it.
string
required
The file’s path in your data folder, as reskate.files.write takes it. A folder it names is made. A file already there is replaced.
table
required
boolean
True when the saving started.
string
With false: "nothing was recorded", "a capture is being saved", "a folder is there", or "more than 64 file calls in a second".
An option out of its range, a path that is not one, or a png of more than one frame raises an error.
Needs the capture and files permissions. It counts as a call to reskate.files: at most 64 a second, together.

Fit Check

The Fit Check plugin, contrib/plugins/fit-check in the ReSkate repository, uses all of this. It does the following:
  • On V, it finds out which screen is open with reskate.menu.grid and reskate.menu.game.
  • It turns the board or skater with reskate.room.turn.
  • It finds where one turn comes round with compare.
  • It eases the stick off when the turn is too fast for the frames wanted.
  • It saves the frames nearest evenly spaced points of the turn, with a card of reskate.outfit.board or worn.