BETA — Preview build
Skip to content
Turn lights, sounds or other functions on or off

Set function ​

Turns a function of the selected vehicle on or off, such as the headlights, a horn, or a sound.

Settings ​

SettingDescription
SelectorHow the function is chosen: by Icon or by Function, see below.
IconOnly for Icon: the function icon to look for, such as a whistle, horn or light.
FunctionOnly for Function: the function, picked from a vehicle in your vehicles list.
Function onOn turns the function on, off turns it off.

By icon or by function ​

  • By icon — When the action runs, Model Train Script looks up the selected vehicle in your vehicles list and uses its first function with this icon. This makes a script vehicle-independent: "sound the horn" works for every locomotive that has a function with the horn icon, whatever its function number is.
  • By function — You pick an exact function from one vehicle in your list, including its number, type and time. The action always uses that function number, also when a different vehicle is selected.

How it works ​

  • The function type configured on the vehicle is respected. A pulse function always gets a short trigger, whatever Function on is set to. A time function switches off by itself after its configured time.
  • With By icon, nothing happens when the selected vehicle is not in your vehicles list or has no function with that icon. The script continues normally.

TIP

Give the same kind of function the same icon on all your vehicles (for example the horn icon for every horn). Then you can write one set of scripts that works for your whole fleet.