> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/dart-game/board-placement.md).

# Board Placement

Auto-detected boards and the admin placement commands.

A board becomes playable in one of two ways:

* **Auto-detection**: dartboard props that already exist in the world.
* **Admin placement**: boards added in game with `/darts_create`, saved in the database.

## Auto-detection

With `Config.AutoDetect = true` (default), every world prop whose model is listed in `Config.BoardModels` becomes a board as soon as a player is in the area. Nothing has to be set up.

```lua
Config.BoardModels = {
    'prop_dart_bd_cab_01',
    'prop_dart_bd_01',
}
```

* Auto-detected boards are not saved. They are found again after every restart.
* They get an id made from their position, such as `auto_1994_3050_47`.
* Their position is the position of the prop. To move one, move the prop in your map.

Set `Config.AutoDetect = false` to use only the boards your admins place.

## Admin commands

The commands are for admins only. See [Installation](/docs/scripts/dart-game/installation.md) for how admin access is granted.

| Command         | Description                                       |
| --------------- | ------------------------------------------------- |
| `/darts_create` | Place a new board on a wall.                      |
| `/darts_delete` | Delete the placed board you are standing next to. |
| `/darts_list`   | Show the id and name of every placed board.       |

### /darts\_create

{% stepper %}
{% step %}

### Aim at a wall

A transparent board follows your camera. Look at the wall you want it on, from up to 8 metres away. The board snaps to the first surface it finds.
{% endstep %}

{% step %}

### Adjust the position

| Input                   | Action                                        |
| ----------------------- | --------------------------------------------- |
| **Arrow keys**          | Move the board along the wall, 5 cm per press |
| **Scroll wheel**        | Rotate the board, 5° per step                 |
| **Page Up / Page Down** | Move the board away from or towards the wall  |
| **Left mouse button**   | Confirm                                       |
| **Right mouse button**  | Cancel                                        |
| {% endstep %}           |                                               |

{% step %}

### Name the board

After you confirm, a dialog asks for:

* **Board ID**: 3 to 32 characters, unique. It is saved in lower case with spaces turned into underscores, for example `pub_main`.
* **Board display name**: 1 to 64 characters.

The board is saved to the `darts_boards` table and is playable right away, without a restart.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
If the message "Invalid position" appears, something is too close to the board. Run the command again and pick a spot with more room.
{% endhint %}

### /darts\_delete

Stand within `Config.LobbyRadius` (4 metres by default) of a placed board and run the command. A dialog shows the board's name, id and distance and asks you to confirm. The board is removed from the database and disappears for everyone.

The command is meant for placed boards. An auto-detected world prop is found again by the next scan; to stop world props from being boards, set `Config.AutoDetect = false` or remove the model from `Config.BoardModels`.

### /darts\_list

Opens a dialog with the id and name of every placed board. Auto-detected boards are not listed.

## data/boards.json

This file is a copy of the `darts_boards` table that the script rewrites on every start and after every `/darts_create` and `/darts_delete`. Do not add boards to it by hand: your changes are overwritten on the next start. To add a board, use `/darts_create`.
