TransportControl uses a script system to adapt the controlled transport system logistically and visually to the current requirements. There are three different types of scripts. Each type allows the customization of its own area.
At run-time scripts can be edited with the FULL access level via the browser UI. Changes are stored on the server and are globally and immediately effective.
Scripts of type SERVER are called and executed by the core loop of the central TransportControl Server. Here, the logistics of a controlled system can be adapted. Some input signals don't have a predefined meaning in TransportControl and can be linked with actions only by using SERVER scripts. For example, it is possible to create jobs or to block segments if vehicles are located in predefined positions or if stations transmit signals.
The modular code block of a script corresponds to a function activated by TransportControl according to the interval selected. Three objects are transferred to this function:
- targetList: Array - includes all targets (vehicles and stations) logged-in on the system
- self: Script class - the script currently being executed
- h: Helper class - provides various supporting functions.
By using these four objects more objects will become available. Public features and functions of each object can be directly accessed within the scripts. In the following list of functions Java data types are used to illustrate the underlying classes.Script-Examples - Type Server
Scripts of type UPDATE are executed repeatedly within the browser UI, taking into account the set interval. They are usually used for the customization of the map. Theoretically, however, each parameter and function from the source code of the UI can be manipulated or called. A full description of all possibilities is beyond the scope, so only the most common applications are presented in this documentation.Script-Examples - Type Update
Scripts of the Typ CUSTOM will be executed, if a mobil optimised custom UI will be requested via the address bar of the web browser.
While the header and footer are predefined, the content can be designed via a custom script. If no active script is found during the call, a corresponding error message appears. The Custom UI is called using the following URL:
http://[SERVERIP]:[SERVERPORT]/transportcontrol/?script=[UINAME]Script-Examples - Type Custom