> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-horse-racing/creating-a-race.md).

# Creating a race

Build a race in CAS Horse Racing with the in-world sky camera — lay the start line and gates, place the walk-up race master, then set the fee, laps and post time.

You need [permission](/script-documentation/cas-horse-racing/permissions.md) for this. Ordinary players do not.

## Start

Ride or walk to where you want the race to begin, then type:

```
/race_build
```

The camera lifts off you. Fly it with **W A S D**, hold **Shift** to go faster, **Space** and **Ctrl** to rise and drop, and move the mouse to look.

Press **ESC** or **Backspace** at any point to put the camera down. What you have laid out so far is kept.

## Lay the course

| Key                    | Does                                                                  |
| ---------------------- | --------------------------------------------------------------------- |
| **G**                  | First press lays the start line. Every press after that drops a gate. |
| **F**                  | Removes the last thing you placed.                                    |
| **Left / Right arrow** | Makes the gate wider or narrower.                                     |
| **E**                  | Moves on to the next step.                                            |
| **Q**                  | Puts the camera down.                                                 |

You need a start line and at least two gates. The text at the top of the screen counts them for you.

Gates must be at least 25 metres apart. If you drop one too close you will be told.

## Place the race master

Press **E** once your gates are down. A faint figure now follows your crosshair. This is the person players walk up to.

| Key                    | Does                                                                             |
| ---------------------- | -------------------------------------------------------------------------------- |
| **Left / Right arrow** | Turns him. The heading and compass direction are shown at the top of the screen. |
| **G**                  | Stands him there and opens the race sheet.                                       |

Check the direction on screen before you place him. Judging which way a person faces from forty metres up is guesswork.

He does not have to be on the start line. Put him where players will find him, next to a road or in a town.

## Fill in the sheet

The camera comes down and the race sheet opens.

| Field              | Notes                                                 |
| ------------------ | ----------------------------------------------------- |
| Title              | What players see. Required.                           |
| Description        | Optional.                                             |
| Region and surface | Labels only. They appear on the race card.            |
| Entry fee          | What each rider pays. Set 0 for a free race.          |
| Laps               | How many times the course is ridden.                  |
| Min and max riders | Leave at 0 to use the server defaults.                |
| When they are off  | Pick a preset or nudge it. This is the important one. |

The map on the right shows where the race starts.

Press **Create the race** when you are done.

## After creating

The race master appears where you placed him and the race goes on the calendar.

Players can now walk up to him and press **E**, or open `/races` from anywhere.

## What happens next

| When                        | What                                                                                                                        |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Straight away               | The master stands there. Players can look at the race but not enter yet.                                                    |
| 10 minutes before the start | Entries and betting open. Everyone on the server is told.                                                                   |
| 1 minute before             | Riders who entered are called to the line.                                                                                  |
| At the start time           | Anyone entered and standing within 60 metres of the line is off. Anyone entered who is not there gets their entry fee back. |
| After the finish            | Prizes are paid, bets are settled, and the master disappears. The result goes to the standings.                             |

If fewer riders are at the line than `Config.Lobby.minRiders`, the race is called off and everybody is refunded.

## Moving a race

If you need more time:

```
/race_delay 15
```

That moves the next race 15 minutes out. To move a specific one, add its number:

```
/race_delay 30 4
```
