# Events

## Events

Register with `client.set_event_callback(name, fn)`. The callback gets one table with the listed fields.

#### match_start

Key | Description
--- | -----------
**mode** | The match mode.

#### match_end

Key | Description
--- | -----------
**mode** | The match mode.
**won** | Whether you won.
**quit** | Whether the match was quit.
**coins** | Coin delta.

#### turn_start

Key | Description
--- | -----------
**ours** | Whether it is our turn.

#### shot_fired

Key | Description
--- | -----------
**angle** | Aim angle, radians.
**power** | Power, 0..1.
**english** | Side and top spin, `{ x, y }` each -1..1.
**autoplay** | Whether the autoplayer took it.

#### ball_pocketed

Key | Description
--- | -----------
**number** | Ball number.
**pocket** | Pocket index.

#### game_state

Key | Description
--- | -----------
**state** | The game state as an integer.

#### queue_phase

Key | Description
--- | -----------
**phase** | The queue phase as an integer.