# Protocol: events

The `events` commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to [all commands](../protocol-commands.md).

## events.read

`events.read {name?: text} -> {step: integer, events: [record]}` · read, read-only

Reads the events the last step sent. They stay readable until the next step starts.

| Parameters | Type | Meaning |
| --- | --- | --- |
| `name?` | text | Only events with this name. Left out: every event. |

| Result | Type | Meaning |
| --- | --- | --- |
| `step` | integer | How many fixed steps have run. |
| `events` | [record] | One {name, entity, other, value} per event, in the order sent. entity, other and value may be null; other is the second entity of a contact or a sensor event. |

## events.since

`events.since {step?: integer, after?: integer, name?: text, to?: integer, against?: text, run?: text} -> {step: integer, from: integer, made: integer, events: [record], against: text, run: text}` · read, read-only

Reads the events of every step after a given one, each with its step: what was sent during a game.step of many steps or a game.try. The log is of one line of time: game.reset starts it again at step 0 and game.restore at the snapshot's step, and it keeps the latest 65536 events.

| Parameters | Type | Meaning |
| --- | --- | --- |
| `step?` | integer | Events of steps after this one are returned: pass the step of the last answer you had. Left out: every event the log keeps. |
| `after?` | integer | Only events whose `n` is greater: pass the `made` of the last answer you had to get each event once, whatever the step. When `made` comes back smaller than the one you hold, the log was started again (game.reset, game.seek that loaded, game.restore): start from 0. |
| `name?` | text | Only events with this name. Left out: every event. |
| `to?` | integer | Only events of steps up to this one. Left out: up to the step the game is at. |
| `against?` | text | "accepted": the events of the game as it was last accepted (`frost test --write` keeps it in .frost/accepted beside the project file), played aside from its own files on the recording from step 0 to `to` (left out: the step the game is at): what a timeline draws as the accepted run's events beside the ones now. The game being served is not touched. Left out: the game's own log. |
| `run?` | text | Another of the game's recorded runs, read in place of the game's own: a project file with a `replay` in the game's folder, named from it with `/` as `frost test` lists them (tests/jump.toml), played aside from step 0 on its own recording. With against, that run as accepted. The game being served, and the run it plays, are not touched. Left out: the game's own. |

| Result | Type | Meaning |
| --- | --- | --- |
| `step` | integer | How many fixed steps have run. |
| `from` | integer | The step the answer starts after: the one asked for (0 when none was), or a later one when the log does not go back that far. |
| `made` | integer | How many events were sent since the log was started: the `n` of the newest. |
| `events` | [record] | One {n, step, name, entity, other, value} per event, in the order sent. n counts the events from 1. step is how many steps had run when the step that sent it ended, as events.read would have said it. |
| `against` | text | "accepted" when the events are of the accepted game, else null. |
| `run` | text | The run asked, as it was named; null for the game's own log. |
