> For the complete documentation index, see [llms.txt](https://docs.lostdev.store/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lostdev.store/races/route-creator.md).

# Route Creator

Routes are built entirely in-game—no external editor or file editing required. All commands below require `Config.Admin.permission` / `Config.Admin.allowedGroups`.

## Starting the editor

Run `/racecreator` to toggle the route editor on or off. This also opens the admin panel in the NUI, which mirrors everything below with buttons and live previews—the chat commands and the panel operate on the same in-progress **draft**.

## Building a draft

| Command                                             | Effect                                                                                                                         |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `/race_new [key] [label...]`                        | Starts a new draft. `key` becomes the route's unique id (auto-generated if omitted). Remaining words become the display label. |
| `/race_setlabel <text...>`                          | Sets/renames the display label.                                                                                                |
| `/race_settype <type>`                              | Sets the race type (see valid values in the NUI/`shared/races.lua`—e.g. sprint, circuit).                                      |
| `/race_setcategory <category>`                      | `ranked`, `casual`, `illegal`, etc.                                                                                            |
| `/race_setstartmode <mode>`                         | `grid` or `same_point`.                                                                                                        |
| `/race_setgridorder <mode>`                         | How grid slots are assigned (e.g. by join order).                                                                              |
| `/race_setlaps <n>`                                 | Number of laps.                                                                                                                |
| `/race_setplayers <min> <max>`                      | Lobby size bounds for this specific route.                                                                                     |
| `/race_setreward <base> <xp>`                       | Base cash reward and XP for finishing.                                                                                         |
| `/race_settimes <gold> <silver> <bronze> [percent]` | Medal time thresholds; append `percent` to treat them as a percentage rather than fixed milliseconds.                          |
| `/race_setillegal <true\|false>`                    | Marks the route illegal (auto-sets category to `illegal`).                                                                     |
| `/race_setdispatch <0-100>`                         | Chance (%) an illegal run alerts dispatch.                                                                                     |
| `/race_setwantedcrime <text...>`                    | Wanted-crime label shown to dispatch/police.                                                                                   |

## Placing points

Keybound while the editor is active:

| Command               | Default key   | Effect                                                                             |
| --------------------- | ------------- | ---------------------------------------------------------------------------------- |
| `/race_setstart`      | **Home**      | Captures your current position as the route's opening/start point.                 |
| `/race_setsamepoint`  | **End**       | Captures the same-point start location.                                            |
| `/race_addgrid`       | **Page Up**   | Adds your current position as a grid slot.                                         |
| `/race_addcheckpoint` | **Page Down** | Adds your current position as the next checkpoint (finish is the last checkpoint). |

Removing points:

* `/race_removegrid <index>`
* `/race_cleargrid`
* `/race_removecheckpoint <index>`
* `/race_clearcheckpoints`

## Testing before you publish

* `/race_preview` — shows the route's markers/blips in the world without starting a race.
* `/race_test` — runs a solo local test of the current draft.

## Publishing

* `/race_save` — saves the draft to the database immediately (requires `Config.Admin.saveDb`). This is the normal way to publish a route; no server restart needed.
* `/race_export` — prints a ready-to-paste `Config.Routes` Lua snippet to the server console (requires `Config.Admin.exportConfig`). Useful if you prefer routes checked into `config/config.lua` instead of the database.
* `/race_writefile` — writes the exported snippet to a file (`Config.Admin.writeFilePath`), off by default (`Config.Admin.writeFile = false`).
* `/race_cancel` — discards the current draft without saving.

## Database vs. `Config.Routes`

If a route saved to the database shares a `raceKey` with one defined in `Config.Routes`, `Config.DatabaseOverridesConfig` decides which one wins (database wins by default). This lets you ship a few default routes in config while still letting admins edit or override them from the database without touching code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lostdev.store/races/route-creator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
