How to write a timetable file for the Traffic Screensaver ?

This page is not a full description, it is a collection of examples. It should describe the basic ideas and to make it possible to change or create timetable files - even if you do not use all the possibilities. All the examples in this text are stored in the file cookbook.ini - you can watch the result of the examples running this file in the screensaver (start the configuration window of the screensaver, select this file as the "Timetable file", and start it with "Test in Window" (or Test in Screen). You should look at the stock.ini file to see some other examples too. This file shows the most possibilities of the timetable file syntax - as this file serves for testing purposes too.

The vehicle pictures mostly have their own names inside the Traffic screensaver. This name - and the picture source (picture file name or library name and resource selector), and some attributes are stored in the Stock List file. (After setup it is the traffic.stb or traffic.stk file.) You can browse all the vehicle pictures in the Stock List windows - you can start it from the Configuration dialog (button Stock List) - or directly from your Start menu.

The Stock List window shows the (internal) name of the picture, the picture itself, and some property values. The ~ in the picture name is followed by the version part of the picture name. You can access the same picture with or without the version part:

The name BR103_1~V3 means the 103 in the original MM&MM V3 Screensaver (you can use it only if you have a registered full version), the name BR103_1~OFZ means the 16 colour version from Pierre Ofzareck. If you write only BR103_1, you get the first version existing in your stock list: if you have a registered V3, and therefore the upper line too, then the upper one, if not, but you have the picture of the other (the g_0104.tvl library file containing it, or as a separate GIF file), than that. This version handling helps to write timetable files for others, with _and_ without the registered version or extension kits. (The selection - and deletion - of the stock list lines is done by installation or can be repeated by the "Reinstall Stock List" menu item in the Configuration window's File menu.

If you want, however, you can use directly a picture file with its pathname in the timetable file: if a name has point, backslash or slash ( . \ / ) characters in it, it is a pathname, if none of them, it is a picture name from the stock list.

Now let us begin to write a new timetable file. As the most parameters have default values, we do not need to define all the possible parameters - we can begin with a very simple example:

Build a train:

Write a single vehicle name in a new file with C= before it, save it, set it for the screensaver as "Configuration file name", and test the result (push the Test in: Window or Test in: Screen buttons in the configuration window).

Only the 103 engine goes through the screen - if you have multiple lines, then in all lines.

If you write more lines into the file, this lines will be interpreted in the original sequence or in a random sequence depending on the setting in the Configuration panel. So, you can write all the examples below into consecutive lines.

Let us connect some coaches to the engine:

The same train - in a most compact form:

the train is set together from a BR103_1, an AM1, an ABM1 picture, and 3 times the BM1 picture.

Let's make variations:

one time there is a DMD coach behind the engine, other time a POSTMRZ coach - the selection is made by a random number generator.

You can give possibilities for the selections:

means: the DMD coach is selected with the weight 3, the POSTMRZ coach with the weight 7: the possibility of a DMD is 30%. It is a real possibility selection, you do not get 3 consecutive times the first and after that 7 times the other coach, you get each time a new train started with 30% possibility a DMD and 70% possibility a POSTMRZ coach.

You can define more values and possibilities for repetition counts too:

means: there will be with 2/6 possibility 3 BM1 coaches, with 3/6 possibility 4 BM1 coaches, and with 1/6 possibility 5 BM1 coaches.

If the possibilities are equal, there is a more compact form:

You can combine the concatenate, select and possibility commands:

As you see, it is possible to repeat 0 times a picture: it means (of course): no such picture. The train above consists of
- one BR103_1 engine
- with 80% probabilty a luggage coach
- first class coaches with different probabilty from half up to two coaches
- 3 - 5 second class coaches

The highest precedence has the repeat command (*), in the middle is the selection ( | ), and the lowest precedence has the concatenation. You can change the precedence enclosing some parts of the expression in parenthesis - its behaviour is as usual, the inside part of a parenthesis is evaluated first.

You can repeat a vehicle with both the * and @ characters. If you multiply a single picture, there is no difference: both 3*BM1 and 3@BM1 evaluates to 3 identical coaches. There is a slight difference although, if you repeat a selection. The * character repeats the whole selection expression, the @ repeats the selected item. It means:

creates a freight train from empty container waggons, the green french and the blue hungarian waggons are mixed with each other.

The same Taurus engine pulles 15 empty container waggons, but in this case all of the waggons are the same type: maybe all are the FRET green waggons, or all are the blue hungarian waggons.

How to get realistic events of some identical waggons near each other, and then others and others - but in small groups ? If we write:

we get the effect of small identical groups, but the total length of the train can vary between 7 and 30 - it is a too wide interval. There are two special modifiers acting on the whole train, which solve this problem.

will generate no more then 25 vehicles.

The other modifier:

limits the train length in 1000 pixel (more precisely: only the last vehicle is above 1000 pixel, if the train becomes longer, no more vehicle pictures are appended) - you can mix 2 axle and 4 axle freight waggons, your freight train's length is about what you want.

The engines has no special role in the traffic screensaver. You can define the engine with the same probability commands, as the coaches:

means the same train (4 second class coaches and a post) with different engines. Watch the screen running this line: if the 103 electric locomotive pulls the train, there is a catenary too, is it the 218 or 128 type diesel engine, there is no catenary.

The composition of double heading or pushed train is simple too, as the locomotives has no special role:

is a heavy freight train from 25 hopper waggons pulled by two and pushed by a third BR151 engine in blue-beige livery.

Moving properties:

Let us change some properties of the movements.

Direction: the vehicle goes always from left to right, D=L; means: right to left.

The sequence of the vehicle pictures depends on the direction of the movement, the C= ...; part defines them from the first to the last picture. If you have a DMU / EMU, drawn as parts, you should preserve the sequence - the left part of an EMU is always the left part, not depending on the moving direction. You should start the train with the < (from left to right) or > (from right to left) character to preserve the "definition direction", not depending on the "moving direction":

Each train can have an individual speed:

The speed of the train depends on this individual speed - defined with the V= command - and an overall setting, which is to change with the V keyboard command, or from the menu called by right mouse click, when the screensaver runs. The speed is a real number, you should use decimal point, if you write a fraction too.

Movements:

Till now all the trains simply go through the screen, we have no interesting movements. The M= ...; command defines the movement type:

is the same, as without the M= part - the train goes through (the default value for the M= parameter is SIMPLE)

the train stops, waits a little time, then starts and goes out.

the train stops, waits and goes backward.

With the movements STOP and BACK we can specify all the parameters a SIMPLE movement can have, and some new ones too:

B= defines the acceleration in the breaking phase, A= is the acceleration, when the train starts. Both numbers are real number: use a deciamal point for selecting the fraction. The P= defines the position, where the train stops. The position has a complex syntax (to cover the different screen resolutions and the synchronization with the foreground-background pictures), let us see some simple examples:

means: the left side of the train stops at the 10% of the screen width.

The middle of the train stops in the middle of the screen (50%).

The right side of the train stops in the right part - at 80% of the screen width - of the screen.

The train stays 10s (instead of the default 5 s waiting time). The T= parameter has a more complex syntax: while the train stays, you can start several animations - we will return to the T= parameter later..

The movement FOLLOW is a special one - many "trains" follow each other, having a minimal distance compared with the usual railway security distances. This movement is mostly for road and city traffic:

In this examples there are 3 tramways: the last one is consisting of 2 pictures. Notice the difference between the delimiting semicolon and colon, and the fact that the list separated with semicolon is enclosed in parenthesis (the semicolon outside parenthesis terminates the C parameter).

The way (rail, street, catenary) the train/car/lorry/tram uses have a default value - it is defined in the Stock List. Simple rules combine this default value with each other for different pictures - an electric locomotive with coaches have rail and catenary, a diesel locomotive has only rail, a lorry has only street, a tramway has street and catenary. Uncompatible vehicles have none of the uncompatible thing: electric locomotive and subway with 3. rail together generate only the normal rail, neither catenary nor 3. rail.

The M=FOLLOW; movement does not look at all of its "trains", it checks only the first one. If the first vehicle doesn't match the way type you need, you should specify the way code.

- the bus implies only a street line, no catenary, so to specify the way for the tramway is necessery.

The traffic screensaver have much more way pictures, as the default pictures. You can select the way code with the W command:

The first character defines the street or rail, see Appendix A for the pictures.

An E follows the code for a catenary.
A M (or S) follows the code for the 3. rail.
An L and a number follows the code for a catenary lower as usually, the number is the height in pixels (or centimeters in real life).

You can even use your own way pictures - you will see it at the description of the foreground-background pictures.

The movements mentioned above let the trains to remain together - it is only one "train" in the movements till now.

The two Regio-Shuttles will be divided. The two trains come in from right to left (D=L) coupled, stop in the middle of the screen (P=*50), wait some time (5 s is the default), then the left one goes out to left (D1=L), the right part (consisting of two units) waits, and at the end the right part goes out to right (D2=R). You can extend the line with more parameters: to specify the waiting time, acceleration, highest speed separately for each train part, even you can start some animations, if the trains have any animations - for example, you can open and close the doors, to set up and down a pantograph.

The counterpart is the "UNIT" movement coupling two train parts together:

The light DMU with two coaches (C1=BZMOT0,BZX1,BDZX;) comes in from left to right (D1=R;), it stops. After 3 seconds (T1=3;) a single DMU (C2=BZMOT0;) follows it from left (D2=R;). The second one stops near the first one, and after a small wait time it goes slowly until the first train. The coupled trains wait 5 seconds (T2=5;) and than go back to left (D=L;).

The UNIT movement is not only for binding 2 DMU-s or EMU-s together: a second locomotive (double heading) or a pushing locomotive can be coupled with this movement too - as with the CUT movement the extra locomotive can leave the train.

The CHANGE movement changes one part of the train with another:

changes the hungarian V63 electric locomotive (C1=M_V63;) on the border station to an austrian 1042 (C2=OBB1042R;) - the train itself is a short one from 5 austrian coaches (C=WRMOZ,3*BMOZ,AMOZ;). The train comes in from right to left (D=L;), it stops at 10% of the screen, the 10% remains empty before the V63 engine (P=<10;). After a short wait time the V63 goes out left. After the second wait period the new engine, the 1042 comes in from left, will be coupled with the train, the third waiting time begins, end at last the whole train leaves the screen to left.

As you can use the same picture in both the old and new train parts C1 and C2, you can use this movement to add new coaches in front of the train:

The hungarian diesel locomotive (C1=M_M41F) will be changed to itself with an extra coach (C2=M_M41F,BAM5400L;) - a new coach will be added in front of the others, the shunting is done by the train locomotive itself.

The movement pair M=PUT and M=GET act at the end of the train. PUT adds some new waggons to the train, the shunting engine goes back from where it came, the train leaves in its original direction:

The counterpart is the GET movement: the shunting engine brings away some coaches from the end of the train:

Of course there are more parameters to set individually them (speed, acceleration, wating time and animations to start, foreground and background pictures etc. - but these lines are enough to get a shunting movement at the end of a train.

Let's create a new vehicle!

Aren't the vehicles already painted ? Yes, sure. But we can modify them in run time - increasing the variety. And we can create moving vehicles from single pictures - steam engines moving their wheels, electric engines lowering their pantographs, trams and multiple units opening and closing their doors.

Where to put the commands creating new vehicles, extending or modifying the existing vehicle pictures ? There are more possibilities:

Where to put to modifiers ? It depends on you - all 4 places work. I follow the next rules:

In the following examples I do not show whole lines for a timetable file, I show only a part defining a single vehicle. If you want to test the expression in a timetable file, use:

if it is an engine or a motorcar, multiple unit, truck, tramway; and use - for example:

for waggons, passenger coaches - a shunting engines is a good selection for each type of railway vehicles.

It is much more simple to test the following expressions in the "Graphic Testpad" - you can start it with a button from then configuration window.

Loads, symbols, grafitties

All these is done with placing a picture (or more pictures) on top of the vehicle picture. The commands modifiing the pictures are written in brackets.

For the first examples I use the freight waggon M_LGS and some containers:


M_LGS

C2001

The command [O: ] places a picture on the other:


M_LGS[O:C2001]

the container is on the top of the waggon, in the middle. The first numeric parameter is the horizontal coordinate (in pixels) of the placed picture.


M_LGS[O:C2001,6]

If the number is preceeded with an asterisk ( * ), the center of the new picture will be placed at the given coordinate, the > means the right side of the picture. You get the same result as above with the following expressions too:

Let's place another container on the right side:

The second number in the brackets is the vertical position. Y coordinates are measured from the bottom (from the rail or street) to the top. In the first expression we could omit the vertical position: the container is placed onto the waggon. This placement creates a new picture, which height is 39 pixel instead of 14 pixel. If we write simple M_LGS[O:C2001,>68][O:C2003,70], it generates an error message Overlay picture "C2003" not in parent area - as the second container above the first is higher, as the place of the catenary: the MM&MM compatible vehicle set defines the place for vehicles in 58 pixels.

We should define the vertical coordinate with the most freight wagons, as the loading surface is usually not the highest point of the wagon:


GO42[O:C2001]

the container "flies" above the wagon, we should push it down:


GO42[O:C2001,,12]

(the horizontal coordinate is missing, as the default value, the middle of the container to the middle of the wagon is O.K. for us).

The most wagons have a side wall. We can store only the upper part of the load - for example, coal or wood:


GO69
+
FR06
=
GO69[O:FR06,,29]

but if we want to use the whole picture of the load, we can "push it down behind the side wall" with the third numeric parameter:


M_ROLL[O:KAMION03,,10,4]

The truck is a complete picture as shown here:

(The Traffic Screensaver is designed for both transparent and opaque pictures. With transparent pictures you have an another possibility the achieve the same result - this way is simple and works with opaque pictures too, even if it doesn't follow the logic of the real life, and it is useable only if the top of the wagon has the same height, there are no holes in the side wall).

If we define a container train, it is boring to type every time the same coordinate values into the [O: ] commands. There are some more commands, with which you can overcome this problem:


GO56[P:C1,5,14][P:C2,68,14][P:C3,131,14][C1:C2004][C2:C2001][C3:C2006]

Is this a longer line as GO56[O:C2004,5,14][O:C2001,68,14][O:C2006,131,14], isn't it ? Yes, it is. But you can separate the fix and the variable part, and to define the fix part in a macro - even in the Stock List, associated the macro with the GO56 vehicle. Then you have one time the

line, and each time you want to use the container wagon, then only the

line (of course, a similar line with other container names).

The $DEF line is an unusual definition - as it redefines itself, with the same name. The traffic screensaver looks for macro definitions backwards, it begins with the last definition and compares the names towards the first definition. If it finds a name match, it tries a next match for all of its components, but it starts before its own definition. If it doesn't find the name as a macro, the name should be the name of a picture. This rule helps you to redefine vehicles already used at many places in the timetable file - to redefine, for example, in order to define placing points for the overlay pictures. The [P:<name>,<x>,<y>,<hide_y>] command defines a placing point for an overlay picture. The following [<name>:<picture>] command sets the picture to the predefined place.

If the overlay picture is drawn transparent, there are two different possibilities:


MBHVT[O:GR_01,34,8]

you use the transparent part to look through to the vehicle picture, or you let the original vehicle picture to disappear on the places the overlay picture has transparency. This second possibility is the [OT: ] command - the parameters are the same to the [O: ] command.

If you need only a square with a single color, you do not need to draw a square and store it as a separate picture file: the [B: ] command does it for you:


BUE

BUE[B:19,14,6,3,#FFFF00]

a direction table is painted onto the coach. The parameters are:

where color is defined identically to the HTML rules: after a # character the Red, Green and Blue intensities as 2-character hexadecimal numbers. (There are two more ways to define a color, described later).

In the previous part we have constructed a loaded wagon combining the pictures of the wagon and the freight. It is the logical, preferred method - you can combine several wagon pictures with several freight pictures. But there are many existing pictures abroad with loaded wagons. There is a simple command, which lets the freight to disappear, the "brother" of the [B: ] command, the [BT: ] - it has no color parameter, only the four numbers, as it makes the square transparent (the same as the background color, if you do not use transparency, black, if the settings are compatible with the MM screensavers).


USKOHLK

USKOHLK[BT:12,38,142,7]

Vehicles from phase pictures:

(If you do not want to define moving pictures, you only use the predefined ones, you can skip this chapter.)

The + sign denotes the composition:

is a vehicle drawn in 4 phases. As the vehicle moves, this phases will be shown one after each other. The picture draw on the screen depends on the distance of the vehicle from the left side of the scree, so, if th M31 hungarian shunting engine moves from left to right, the sequence shown is:

if it moves from right to left, the sequence is reversed.

How many pixels should the engine move to change the phase picture ? As the different vehicles have wheels with different diameter, the Traffic program cannot know the right value. It has a default value - but in this case the default value does not fit your expectations. You can define the distance in pixels needed to move in order the change to next phase with the +.<number> construct:

means: after each 8 pixel movement the phase picture will be changed.

There is an other way the define the same property:

means: this engine's wheels have a diameter of 12 pixels. The right value for the changing of the phase pictures will be calculated by the program. For usual vehicles I prefer the second way, as

The first picture (in this case, the M_M31_0) should show the whole vehicle. The other pictures can show only the lower part having a difference in them.

The other phase pictures cannot be longer, as the original picture. It they have different sizes, the result in the area not covered by all pictures is undefined - the Traffic screensaver can overwrite the whole picture of the actual phase with the picture of the next phase, but it is possible, the that the next phase will be constructed from the first, whole picture overwritten only by the next phase picture. So, do not use phase pictures with different sizes.

If the length of the phase pictures are smaller then the whole picture, you can control the alignement by a prefix character before each phase picture's name:

The > means: the phase picture M_424_1, M_424_2 and M_424_3 are aligned on the right side of the M_424_0 picture.

The < means left alignement.

The * means cenetering.

If none of the above fits, but you do not want to paint the phase pictures with the whole length, you can explicitely specify the offset from the left side of the whole picture:

(it is a theoretical example - as at the moment there is no entry in the Stock List using this possibility).

You do not need to use the _0, _1, _2, _3 postfix for the name of the phase pictures - as the full name of the phase pictures is stored in the stock list file, you can use the names as you want. This freedom allows you to reuse the same phase pictures.

--- will be continued soon ---


Appendix A: the Way codes used in the W= parameter

a b u
A B U
r
R
0
1
2
3
4
5
q
Q
p
P
g
G
j
J
k
K
h H


The trafic screensaver homepage