Rail3D*

   

 

Types Of Script



Scripts may be applied to various objects and in various ways.

1 Document scripts

Document scripts apply to a whole document (layout) and respond to events in a layout.

For example, document scripts are useful for operations that apply to all trains, such as routing operations. It would be possible to write a script and apply it to each instance of a train, but in many cases it is preferable to use a single script applied at the document level.

Document scripts are edited using the “Document Script” function of the “File” menu.

Document scripts with names starting Macro_ will appear in the program’s tools/macros menu

2 Macro scripts

Macro scripts are scripts that are invoked on command from the “Run Script” menu item

For example, macro scripts may be written to make global changes to a layout, or to assemble a large layout from a number of smaller sub-areas.

Macro scripts are edited outside the program and invoked by the “Run Script” function of the “Tools” menu.

Macro scripts may also be stored in the “macro” folder, in which case they will appear in the program’s “macro” sub-menu. (But of course there is a limit as to how many scripts can be there at one time).

3 Model scripts

Model scripts apply to rolling stock models and signals and are defined in the model file (or with an include). A script thus defined applies to every instance of the model in a layout.

For example, a script to control raising and lowering of pantographs could be defined in the stock model file as it would apply to every instance of the model.

4 Train scripts

Train scripts are similar to rolling stock model scripts and have the same functions and entry points but are applied to a specific instance of a train.

The Train script for the current train can be edited by selecting “Edit script” from the “Train” menu.

5 Signal scripts

Signal scripts are similar to signal model scripts and have the same functions and entry points but are applied to a specific instance of a signal.

The Signal script for a signal can be edited by clicking the “Script” button on a signal properties dialog.



import