Attach/detach in timetable mode

Registered by r.roeterdink


The existing functions to couple or uncouple trains which exist for and are used in activity mode are presently disabled for timetable mode. The main reason behind this is the basic principle that all actions as defined in a timetable must be set up and executed in such a way that it makes no difference whether this is done by the player train or by an AI train. The present functions to couple or uncouple trains allow the user to perform these actions which cannot be done in the same way by AI trains, and therefor violate this main timetable rule.

This blueprint proposes to introduce as set of timetable commands which will define and execute couple and uncouple actions in such a way that it works the same regardless of whether the train is the player train or an AI train.


Four specific commands are proposed to handle couple and uncouple actions.


This command defines that a portion of the train must be detached. The detached portion can either form a new train as defined in the timetable, or it can form a static train.

The train from which the portion is detached continues as defined.

A detach command can be set in the #note line of a train, the detach will then be performed at the time the train is activated.

A detach command can be set for a station entry, in which case the detach will be performed at that location.

A detach command can also be set in de #dispose line, combined with a $forms command, in that case the detach takes place as the new train is formed.

If the train from which the portion is detached is the player train, there are three different possible situations.

First, only the portion of the train which continues (or is formed into the new train) contains driveable engines. In that situation, the player will continue with the present train, or with the newly formed train.
Second, only the portion to be detached contains driveable engines. In that situation, the detached portion will become the player train and the existing train (or the newly formed train) will become an AI train.

Finally, both portions contain driveable engines. In this situation, a window will pop-up informing the player of the detach action, what will happen to the portion which now contains the player engine, and what will happen to the detached portion. By changing cabs (using ^E), the user can move to the other portion to continue with that train if required. The player must confirm that the detach can take place by clicking on the confirm button in this window.

Note that if the detached portion forms a new train, this train can be selected as the starting player train just like any other train.


The attach command will allow a train to attach to another train. The train which attaches will cease to exist, and will become a part of the other train.

The attach command can only be defined in the #dispose line of a train as it is by definition the last action of that train.

If the attaching train is the player train, the player will automatically be moved to the other train.
Note that a train which needs an attach will not depart from where the attach is to take place until the attach has indeed happened.


As attach, the pickup will allow a train to attach to another train, but in this case it is the attaching train which will continue, and it is the other train which will cease to exist.

As the train which is attached to ceases to exist, pickup is only allowed on trains which are static and are not due to be formed into another train, i.e. the train has no further actions defined in the timetable.

A pickup command can be defined for a station entry, or it can be defined in the #dispose line in combination with a $forms command.


Transfer allows a set of units to be transferred from one train to another. Both trains will continue to exist as defined. Transfer is basically a combination of detach and attach. A transfer can ‘take’ or ‘give’ wagons from and to the other train.

A transfer can be defined for a station entry, or in the #dispose line in combination with a $forms command.

Because a transfer performs a detach as part of the operation, the same rules apply in relation to the player train as which apply to the detach function.

Also, in similarity with the attach function, the train to or from which wagons will be transfered, will not be allowed to depart until that transfer has taken place.

At present, the couple and uncouple actions will be performed fully automatic, obvious for AT trains but also for the player train. This means that the actions on opening/closing angle cocks and attaching/detaching brake hoses can presenly not be performed by the driver but will be handled by the program. The reasons behind this decision is that it allows the same code to be used for both AI and player train, and also that the present windows which control these actions can not be used in timetable mode as they cannot handle the required information in case the detached portion is to form a new train. It is envisaged that this functionality may be introduced at a later stage as optional, with the ability to set this option per train.


Blueprint information

James Ross
Series goal:
Milestone target:
milestone icon 1.3
Started by
Completed by
James Ross

Related branches



Implemented in X3863.


Work Items

This blueprint contains Public information 
Everyone can see this information.