# Action

An action is the component that actually changes something on your layout. Actions are always located inside a [section](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/section).

## Execute conditions <a href="#conditional" id="conditional"></a>

Just like [scripts](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts) and [sections](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/section), every action can be **conditional**. You can configure whether all (**AND**) or only one (**OR**) condition must be met to execute the action.

Conditions can be based on accessories, feedback sensors, vehicle state, flags, variables, or camera detection. If the conditions are not met, the action is skipped and the script continues with the next action.

## Custom label

Every action can have an optional **custom label** that appears alongside the auto-generated description. This helps you annotate actions to keep your scripts readable — for example, "slow down before curve" on a set speed action.

## Action selector <a href="#action-selector" id="action-selector"></a>

Adding an action starts with tapping the + button inside a section. The action selector appears, allowing you to pick the desired action.

<figure><img src="https://4224524483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjZj7d8De4optEMsLAji%2Fuploads%2FbKeREfF9Yn9PVQFlnYvE%2Fimage.png?alt=media&#x26;token=ae0e76d0-7887-4e70-89b4-f17455d28e3e" alt="" width="188"><figcaption><p>The action selector</p></figcaption></figure>

## Action types <a href="#action-types" id="action-types"></a>

Actions are organised into categories:

* [Vehicle control](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/vehicle-control) — Select, drive, and manage your locomotives.
* [Layout control](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/layout-control) — Control turnouts, signals, and other accessories.
* [Timing](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/timing) — Wait for time or conditions.
* [Structure](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/structure) — Execute scripts, set flags, variables, and notifications.
* [Scenery](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/scenery) — Play sounds and effects.

### Overview

| Category  | Action                                                                                                                     | Description                                                  |
| --------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| Vehicle   | [Select vehicle](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#select)                | Set the active vehicle for subsequent actions                |
| Vehicle   | [Select from feedback](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#select-feedback) | Select vehicle by reading a feedback sensor (RailCom)        |
| Vehicle   | [Set speed](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#speed)                      | Set speed as a percentage (0–100)                            |
| Vehicle   | [Stop vehicle](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/vehicle-control)                  | Set speed to 0                                               |
| Vehicle   | [Set direction](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#direction)              | Set direction to forward or reversed                         |
| Vehicle   | [Toggle direction](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/action/vehicle-control)              | Reverse the current direction                                |
| Vehicle   | [Set function](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#functions)               | Turn a vehicle function on or off (by icon or by function)   |
| Vehicle   | [Set profile](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#profile)                  | Apply a vehicle profile (idle, shunting, slow, medium, fast) |
| Vehicle   | [Store state](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#state)                    | Save the vehicle's current state                             |
| Vehicle   | [Restore state](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/vehicle-control#state)                  | Restore a previously saved state                             |
| Layout    | [Set accessory](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/layout-control#set-accessory)           | Set an accessory to a specific state                         |
| Layout    | [Set route](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/layout-control#set-route)                   | Apply a predefined route                                     |
| Layout    | [Set path](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/layout-control#set-path)                     | Automatically find and set a path through the layout         |
| Timing    | [Wait](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/timing#wait)                                     | Pause for a fixed or random duration                         |
| Timing    | [Wait for condition](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/timing#wait-for-feedback-module)   | Pause until a condition becomes true                         |
| Structure | [Execute script](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/structure#execute-script)              | Run another script inline (specific or random by tag)        |
| Structure | [Set flags](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/structure#set-flags)                        | Set script-level flags                                       |
| Structure | [Set variable](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/structure#set-variable)                  | Modify a variable (set, increase, decrease)                  |
| Structure | [Show notification](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/structure#show-notification)        | Display an in-app notification                               |
| Scenery   | [Play sound](https://modeltrainscript.gitbook.io/docs/manual/automation/scripts/scenery#play-sound)                        | Play a sound (blocking or in background)                     |
