Expand description
Input scripts: the steps of a player’s input a tool plays (keys,
controller buttons, an action by name, waits in seconds, the crank, and
the debug view’s channels turned on) and the one plan that turns them into frames of raw input events
(frames). The Harness plays a Script (Script::play, the
harness feature), the live link’s server plays a Play request’s
steps, and a capture plan’s input steps are these (ticket 2566): a key
press is written once.
A step’s form is the same in JSON and in RON: {"keys": "Enter Up"},
{"pad": "South+East"}, {"act": "Confirm"}, {"wait": 0.5},
{"crank": 30}, {"debug": "grid"}; keys("Enter Up") and so on in
a plan’s RON.
Every frame is FRAME_DT long, and a wait is played as
wait_frames of them. How long one wait may be is the player’s to
say, not the step’s: harness::MAX_WAIT, link::MAX_WAIT, a capture
plan’s MAX_WAIT.
Structs§
- Script
- Steps played in order.
Enums§
- Planned
- Frames of a script’s plan.
- Press
- What presses an action: a key chord, or a button (or two together).
- Step
- One step of a script, played in the order written.
Constants§
- FRAME_
DT - How long each frame of a script is: a 60th of a second.
Functions§
- check_
waits - Whether every wait of
stepsis at mostmaxseconds, the most the player plays in one step; an error names the step. - frames
- The frames
stepsgive, eachFRAME_DTlong, with the game’skeymap(for an action by name) and buttons pressed on a pad of kindpad: a key chord or a pad token down in one frame and up in the next, an action as its key or its button, a wait aswait_framesframes with no input (none for a wait of 0). An error names the step (step 3: act: …): oneStep::checkrefuses, an action that can’t be pressed, or a crank, which isn’t played this way (the Harness winds it itself; the live link can’t yet). - press_
for - What presses the game’s action named
nameinkeymap: its primary key (Keymap::primary), else its primary button (Keymap::primary_button). The one lookup of an action by name, so every tool presses an action as a player would. An error names the action: the game has none of that name, or it has neither a key nor a button. - pressable
- The names of
keymap’s actions that have a key or a button, inActionSet::ALL’s order: those anStep::Actcan press. - wait_
frames - How many frames a wait of
secondstakes: the seconds at 60 a second, rounded up, a product within a thousandth of a whole number counting as that number (0.5 s is 30 frames, 1/60 s is 1, 0.51 s is 31). A wait above 0 is at least one frame; a wait of 0, or one that isn’t a number of seconds 0 or more, is none.