> For the complete documentation index, see [llms.txt](https://modeltrainscript.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://modeltrainscript.gitbook.io/docs/manual/automation.md).

# Automation

Model Train Script lets you automate your layout with simple sequential scripts — no programming knowledge required.

To make configuring scripts easier, it is recommended to set up your [vehicles](/docs/manual/vehicles.md) and [layout](/docs/manual/layout.md) first. This allows you to select vehicles and accessories directly while composing scripts.

Automation elements can be edited from the [profile](/docs/manual/profile.md) screen. Check out our [tutorials](/docs/manual/automation/tutorials.md) to get started.

<figure><img src="/files/0vpek3AeXdmTqiLhZZpo" alt="" width="188"><figcaption></figcaption></figure>

## Execution flow <a href="#scripts" id="scripts"></a>

The diagram below gives an overview of how automation scripts are structured.

<img src="/files/sUQQ7wyuYRXJeiz9YI92" alt="" class="gitbook-drawing">

## Scripts <a href="#scripts" id="scripts"></a>

[Scripts](/docs/manual/automation/scripts.md) are small programs that control anything on your layout — vehicles, accessories, sounds, and more. A script is built from [sections](/docs/manual/automation/scripts/section.md) that contain [actions](/docs/manual/automation/scripts/action.md). Scripts can be triggered manually or automatically by layout events.

## Routes

[Routes](/docs/manual/automation/routes.md) let you set multiple accessories at once with a single command. Define a combination of turnout and signal states and apply it from the throttle, layout, or within a script.

## Time tables <a href="#time-tables" id="time-tables"></a>

[Time tables](/docs/manual/automation/time-tables.md) let you schedule your scripts on a time basis, creating different running scenarios for your layout. Configure different timetables for morning rush hour, midday quiet, or evening operations.

## Sounds

[Sounds](/docs/manual/automation/sounds.md) add atmosphere to your layout. Play station announcements, ambient effects, or custom audio files from your scripts using a built-in sound library or your own MP3 files.

## Flags <a href="#flags" id="flags"></a>

[Flags](/docs/manual/automation/flags.md) make your scripts more generic and reusable without the need to duplicate them. A typical use case is enabling or disabling sound for late-night running sessions. Flags work at three levels: global, per-script, and per-vehicle.

## Variables

[Variables](/docs/manual/automation/variables.md) allow you to store numeric values (0–255) that can be used across your scripts for counting, tracking state, or coordinating between scripts.

## Cameras <a href="#cameras" id="cameras"></a>

[Cameras](/docs/manual/automation/cameras.md) can serve as feedback sensors for your scripts by using AI-based detection of vehicles on your layout. They can trigger scripts, act as wait conditions, and work alongside traditional feedback sensors.
