Skip to content
View source

restoreGenerated

Category: Creation protocol · Session

Puts a snapshot’s world back, after a trial frame that commits nothing: the state is the snapshot’s, which the next frame reads; until then read shows the trial frame’s outputs.

Puts a snapshot’s world back, after a trial frame that commits nothing: the state is the snapshot’s, which the next frame reads; until then read shows the trial frame’s outputs.

{"id": 1, "op": "restore", "laws": "current"}
Name Type Required Description
snapshot object no as snapshot gave it; or from
from string no a file snapshot wrote
laws "current" | "snapshot" yes which Kernels the restored world runs under
structure "current" | "snapshot" no which scene; current when not given
time number no session time in seconds; 0 when not given
rate number no the sound clock, frames a second, which Kernels read as rate()
queued number no the samples (per channel) the sound device holds and has not played, which Kernels read as queued(); 0 when not given
pointer [x, y] no the pointer in the output’s pixels from its top left, as a Kernel’s pointer() reads it
down bool no whether the pointer is pressed, what pointer_down() reads
buttons [integer] no buttons held: 0 left, 1 right, 2 middle, then a pad’s
wheel [x, y] no the scroll for this frame
sticks [[x, y]] no a pad’s left stick, right stick and triggers, up to three pairs
pads integer no how many pads are connected, what pads() reads
keys [integer] no keys held, by the browser’s codes
text string no the characters typed since the last evaluation, what typed() reads; 32 at most
window [w, h] no the window in pixels; else the session’s
scale number no the window’s scale factor, with window; 1 when not given

revision, frame, report