# Actions

Present when `client.game()` is `"8ball_pool"`. Positions and velocities are in table coordinates; draw them with `renderer.world_to_screen`.

## Functions

#### pool.table

`pool.table()`: table

Returns the live table: `{ ok, pocket_radius, balls, pockets }`. Each ball is `{ number, position, velocity, radius, active, pocketed }` (number 0 is the cue ball); each pocket is `{ x, y }`.

#### pool.guide

`pool.guide()`: table

Returns the prediction for the current aim and the last shot: `{ can_aim, status, shot, fired, ghost? }`. `shot` and `fired` are `{ valid, aim_angle, power, english, target, potted }`. Calling this keeps the predictor running for a short while even with the game's own guide toggle off, so a script can draw its own guide with the built-in one hidden.

#### pool.paths

`pool.paths()`: table

Returns every predicted ball trajectory: `{ shot, fired }`, each an array of `{ number, pocketed, pocket, points }` where `points` is a polyline in table coordinates. Like `pool.guide`, calling it keeps the predictor running with the game's guide toggle off.

#### pool.autoplay

`pool.autoplay()`: table

Returns the autoplayer's live status and chosen shot: `{ phase, reason, label, has_choice, turn_seconds, search_progress, fired_power, fired_angle, choice }`. `choice` is `{ angle, power, english, target, pocket, pots }`.

#### pool.toggle

`pool.toggle(name: string[, on: boolean])`: boolean

Argument | Type | Description
-------- | ---- | -----------
  **name** | string | A named menu toggle.
  **on** | boolean | Pass to set it; omit to read.

Reads or sets a named game toggle (the same ones the menu exposes). Returns the resulting value.

#### pool.override_shot

`pool.override_shot(shot: table)`: boolean

Argument | Type | Description
-------- | ---- | -----------
  **shot** | table | `{ angle, power, english?, pocket? }`. `angle` in radians, `power` 0..1.

Forces the next shot the autoplayer takes. Returns false when not allowed now.

#### pool.clear_override

`pool.clear_override()`

Drops a pending shot override.

#### pool.queue_select

`pool.queue_select(code: string)`: boolean

Selects a queue tier by its code. Returns false when not allowed.

#### pool.queue_set_bet

`pool.queue_set_bet(code: string, id: integer)`: boolean

Sets the bet id for a queue tier. Returns false when not allowed.

#### pool.queue_enter

`pool.queue_enter()`: boolean

Enters the currently selected queue tier. Returns false when nothing is selected.

#### pool.queue_phase

`pool.queue_phase()`: integer

The current queue phase as an integer.

#### pool.queue_status

`pool.queue_status()`: string

A short human-readable queue status string.

#### pool.forfeit

`pool.forfeit()`: boolean

Forfeits the current match (leave to lose). Returns false when not in a match.