How to use the Traffic Screensaver ?

This page is not a full description, it is a collection of examples, tips and tricks. It should describe the basic ideas and to help you to include update packages and your own drawings into the picture collection, to change or create timetable files - even if you do not use all the possibilities.

Contents

The first steps

Which version do I need ?
Installing the prgonly version of Traffic
The main components of Traffic
Let's make a new timetable file
Building a train
Direction, speed
Movements
Rail, street, catenary
Cutting and uniting train parts
Selecting pantographs
Moving the pantographs
Moving the doors
Foreground, background
Segmentation

Own vehicles

Let's create a new vehicle!
Loads, symbols, grafitties
Mirroring
A vehicle family
Vehicles from phase pictures
Animations
Pantographs

Which version do I need ?

The Traffic screensaver is available with different command sets:

Of course, all the three versions understand the same command lines and modifiers for the vehicle pictures and timetable files: you can let to run all the timetable files created with either the full, small versions (or with a simple text editor) with all the 3 version.

The Traffic Screensaver program itself is independent from the vehicle pictures and the timetabe files (the files descibing, how the vehicles will be combined to trains, which movements will be made: what you see on the screen, when it runs). The most pictures are available for it in the scale of 1 pixel = 10 cm. A huge picture collection is mentained on the Traffic Screensaver Homepage - above 35000 vehicle pictures. The most of the users want to download this pictures too - other have not enough bandwidth for downloading everything for the first try. So, the Full version is available in 3 different forms:

Installing the prgonly versions of Traffic

(if you have installed the traffic_all.exe file, you can skip these chapter)

The Traffic Screensaver is not only a screensaver - it is a tool for maintaining your picture collection, to editing the timetable files (the "program" which determines, what "trains" run, and what they do) - so it is started by the users more often, as a screensaver-only program. Therefore all the install sets can create shortcuts in your Start menu and on your desktop for the configuration window of Traffic (the "Settings" button on the screensaver dialog of windows starts this window too).

If you start it after installing one of the prgonly versions of the program, you will see the following:

It is the "empty" Traffic. Empty, because it have neither a stock list file (picture collection), nor a timetable file. The most functions are unavailable in this state.

Download some of the picture libraries, and put the files into a common directory - the best choice is the program directory Traffic is installed into. If you have downloaded some of the free MM&MM screensavers too, you can put them into same directory too - but if you want to try them as individual screensavers too, then put them into your Windows directory. Download the stock.zip file too. Extract the files into your Traffic directory.

Select the stock.ttt file as the timetable file name. You can do this on several ways:

The timetable file was ready, you should only select it. The picture collection (Stock List) file should be created. The setup.stb file (already in your Traffic directory, it was in the stock.zip archive) contains the descriptive records for all the pictures shown on the Traffic homepage (and a few more). The pictures themselves are in .tvl files or in the MM&MM screensavers; you have already downloaded and extracted them from the .zip files. The function Reinstall Stock List checks all the records in the Original Stock List file, that the corresponding pictures are available on your computer - under the folder you specify for the original stock list file (if you have a folder tree there, all the leaf folders will be checked for the picture files or picture libraries), and in the windows folders. The MM&MM screensaver registered versions (V2 and V3) will be checked on their installed place.

After selecting the original stock list file, Traffic asks you for the name of the Generated Stock List file. Traffic will create this file, and to write the records for the pictures it finds on your computer. Give a name of your choice (for example, stock.stb) - but do not overwrite the setup.stb file, the downloaded original file - you could need it later, if you download more picture libraries, and you want the run once more this function.

You can select between two different formats Traffic stores the descriptive records of the pictures. The .stb format is a (usually compressed) binary format, the .stk format is an ASCII text format. If you are an advanced PC user, and in case of problems or special needs you want to look into this file, or to edit it, then you can use the ASCII format - but for normal purposes the binary format is better. It is more compact, and it loads faster.

After creating a valid stock list file and selecting a timetable file the most of the configuration window functions are available. You can select the language you prefer. The translations are stored in the stock list file (if you will work with more than one stock list file, maybe you will be have different language sets, depending on the stock list filecontents. You can make yourself a new translation or enhance an existing one - it will described later).

If you change the program language, all the windows will be closed, and only the configuration window will be redrawn. The texts in the different languages are different long - the windows should be rebuilt.

The main components of Traffic

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 is the central point for manaaging your picture collection. For navigating in the collection there are the usual ways in Windows - the Up, Down, PageUp, PageDown, Home, End keyboard keys, a scrollbar. You can open more Stock List windows (maximal 10) with the key Ctrl W or Shft W keys.

The entries in the View menu control, which attributes are shown in the Stock List window, and how the status line is used..

The selected pictures are marked by the green square around them. You can set the attributes of the selected pictures. Dragging and dropping the pictures inside a stock list window or between other stock list windows moves the pictures into the new place.

The Stock List is a simple, continuous list of pictures - but there is a hierarchicel system of labels, which help to organise the pictures, to find them. You can yourself organise this labels - to define new ones or delete existing ones, to rename them. To quickly find a place, you can use this label tree in the Label menu entry of the Stock List windows.

In the full version only there is a Label Tree window (to start by the menu entry Find -> Tree View, or with the keyboard key F11 - which gives you a better overview of the structure:

There are some pictures in the collection with similar names, the difference is only in a part behind a tilde ( ~ ) character. These picture show the same vehicle, but usually they are drawn by different persons, they have small differences. 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 or the CD 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 03g2.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, as described in a previous section).

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.

Let's make a new timetable file

The configuration window has a menu entry Functions -> New Timetable File, invoke it - it opens a new, empty timetable editor window.

All the timetable file examples in this text are stored in the file cookbook.ttt - 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.ttt 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.

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 text file by your usual text editor, put a C= before it, save it (extension .ttt), 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.

That's all: you have written your first timetable file!

It goes more easy with the built in timetable editor, and with drag-and-drop. The configuration window has a menu entry Functions -> New Timetable File, invoke it - it opens a new, empty timetable editor window.

Drag the picture from the Stock List window, and drop it on the C= area in the timetable editor window. You get the command line described above.

Press the F5 key in the Timetable Editor window!

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.

Editing with drag-and-drop: if you select more, than one pictures in the Stock List window (with CTRL+mouseclick for individual selection, or SHFT+mouseclick for selecting all pictures between the original and new click), all the picture names will be inserted into the timetable file. If you drop them on the text field, the names will be delimited by comma, and all names will be inserted into the position you drop them. If you drop them onto the small areas in the upper part of the window, the delimiters depend on the label in the area. Dropping them on the   C=   field, a complete timetable line will be inserted in the line after the actual position. The cursor remains in the new line, before the terminating   ;   character - you can drop more pictures on the   ,   field, they will be inserted to the end of the train. If you want to have the repetition, you shoud type the number and the   *   character yourself before the vehicle name.

If you do not want more, as let to run fixed train compositions simply through the screen without stopping, opening doors, moving the pantographs, you can finish reading this text :-)

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. (Dropping vehicles from the stock list window on the   |   field, the vehicles names will be delimited by the  |  character - you insert with a single drop operation the full selection.)

You can give probabilities for the selections:

means: the DMD coach is selected with the weight 3, the POSTMRZ coach with the weight 7: the probability of a DMD is 30%. It is a real probability 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% probability a DMD and 70% probability a POSTMRZ coach.

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

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

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

means 3, 4 or 5 BM1 coaches.

You can combine the concatenate, select and probability 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 expression

is legal too, there is a DMD coach with 50% probability, in the other 50% there is nothing between the engine and the first class coach.

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 - you can mix 2 axle and 4 axle freight waggons, your freight train's length is about what you want. These both modifiers are valid inside a parenthesis too, in that case they limit the length of the part inside the parenthesis. So, you can use this limiting mechanism, when you want to have something fixed on both ends of the train - pushed and pulled heavy train, or a caboose on the train end.

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.

Direction, speed:

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":

It is able to use this fixed definition direction - the   <   and   >   characters - in the beginning of a parenthesis. The expression:

means an accu railcar from two parts - in the correct position, left and right part - pulling a single passenger car. The position of the passenger car depends 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 numbers: 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 example 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 semicolons is enclosed in parenthesis (the semicolon outside parenthesis terminates the C parameter).

Rail, street, catenary

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.

Cutting and uniting train parts

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.

Selecting pantographs

The complete definition of an electrical engine for the Traffic Screensaver includes animated pictures for all of its pantographs. As it is a huge work to draw the animations for each pantographs, there are some other ways too - but then the vehicle picture will have limited possibilities - the pantographs are "jumping" between their end positions, or cannot be positioned at all. The "jumping" pantographs are only less nice, as the ones moving slowly, they can show both states. If the two end positions are not defined at all, you cannot let them move - you should check the engine definition before using it. You can make it by double clicking on the vehicle picture in the Stock List window - the Graphic Tespad will be started. If you find in the top of the window some buttons with the text P1U, P2U etc., the vehicle has movable pantograph. If you push or release this buttons, you can watch the picture of the pantographs - thay are moving slowly, or they are jumping to the other end position. If there are no such buttons, you cannot control the pantographs.

The definition of the pantograph will be described later - now we are looking at the usage only.

The first question: which pantograph is on, when the train moves through the screen ? The pantographs in the Traffic Screensaver are numbered from 1 to 4:

(This numbering is only a convention - if you define the pantographs with individual pictures, the numbering is the sequence as the commands are staying in the macro of the vehicle - but every vehicle in the standard set follows this convention.)

The most electric engines have only pantographs 1 and 2, the default is to run with the pantograph backwards, against the running direction. Some engines and the most tramways have only a single one, it has number 1 - and the default is (of course) this pantograph up.

There are some modifiers you can write into the vehicle macro or in front of the whole train for modifying the default behavior. If the modifier stays after the vehicle name, it changes only the pantograph of the single vehicle which name it follows; if it stays in front of all picture names, it modifies all the vehicles in the train.

The first Tatra tramway has pantograph up, the second down. (The third vehicle is only a trailer.) The [PHU] modifier means: the first pantograph in the moving direction in the whole train is up, all others are down. Some electric railcars have a trailer as first vehicle, it doesn't disturb the selection. The counterpart is the [PTU] modifier - only the last pantograph in the moving direction is up, all others are down.

Both Tatras are going with pantograph up. [P1U] means: first (or the single) pantograph up. You can directly address the other pantographs too, [P2U], [P3U], [P4U] let the selected pantograph up, independent of the moving direction. If you have a defined direction (you use the D=R or D=L parameters), or you want to use a fixed pantograph, as they belong to different current systems, you can use this modifiers.

[PFU] (pantograph forward up) means: the first pantograph of the vehicle (in the moving direction) is up. It means pantograph 1, if the train moves from right to left, and pantograph 2, if it moves from left to right. Do not use this modifier for trams and other vehicles having only a single pantograph, as this modifier tries to set up the 2. pantograph if the direction is from left to right - and this vehicles do not have the 2. pantograph, the single pantograph remains down!

[PBU] (pantograph backward up) means the usual position: the last pantograph (Nr. 1, if the vehicle goes from left to right, and Nr. 2, if goes to left) is up.

There are a few vehicles having 4 pantographs. If the inner pantographs both are used for the same current system, you can use similar modifiers to select the inner pantographs:

[PBIU] means the inner one backwards (Nr. 3 going to right and Nr. 4 going to left), [PFIU] means the inner pantograph forwards.

If the inner pantographs belong to different current systems, you can select the pantographs by their number, not depending on the moving direction:

[P3U] means the third (inner left) pantograph up; [P4U] the 4. (inner right) pantograph up. If the engine has only 3 pantographs, you should set the inner one always with the [P3U] modifier.

Some older engines work often with both pantographs up. Sometimes using newer engines their both pantograph too (for example, if the catenary is full with ice). You can model this too:

is a freight train, the austrian 1020 using its both pantographs.

You can model, if the electric engine itself doesn't work:

- the small diesel engine is pulling the 101 for maintenance - both pantographs are down.

For vehicles with single pantograph is the default: the first vehicle of the "train" with pantograph up, the other with pantograph down. For vehicles with 2,3 or 4 pantographs is the dafault: with the last pantograph up - it is the 2 from right to left, and the 1. from left to right, not depending on the place in the train.

Moving the pantographs

In the actual version we can let moving the pantographs only when the train stays. Setting the pantographs down and up during the movement on defined positions (for example on current system borders, drawn as background picture) is planned for the future versions. We can use the M=STOP, M=BACK, M=CHANGE etc. movements. The animations - as the moving of the pantographs too - are defined in the T= parameter (in all waiting time parameters, if there are more of them).

The waiting time is combined from

1 Wait 1 second
PD Move the pantographs down
5 Wait 5 second. If the pantographs are moving slowly (the phase pictures are drawn), this 5 second start at the start of the movement!
PBU Let the pantographs backwards (depending on the new, reversed moving direction) go up.
W Wait until the pantograph movement is finished.
2 Wait 2 more seconds (after the pantograph movement is finished).

The commands for moving the pantographs are the same, as for selecting the pantographs, when the trains comes in. But be aware: only the [PD] command lets the pantographs down! All the other commands let the selected pantograph go up, and all the pantographs not selected remain in the position they were before. If you have both pantographs up, you cannot set down one, and leave up the other; you can only set down both, and after that let one of them go up. I hope this is not a serious limitation. (If you need this feature, please write me - describing, why you need this feature, where in a real railway you observed such a movement.)

Are ther more vehicles with pantographs, and you do not want to move the pantographs of all vehicles similarly, you can address the vehicles with their train code (in the most cases C, as they were defined with the C= parameter, but in some movements, where there are more trains/trains parts, you should distinguish between C, C1 and C2 trains - as in the M=GET and M=PUT movements.

In this example there are three tramways - two with motor and pantographs, and the third in the middle is a trailer. The tramsway arives its end station - it sets the pantograph of the first (left) ciach down, and after 5 seconds sets the pantograph of the right vehicle up. We can simply give the command to lower all pantographs - the right vehicle has its pantograph down, it doesn't matter. But we do not want to set up the pantographs in both trams, as this type (the UV tram in Budapest) goes with only the first tram having his pantograph up. The command C.3.PU means: select the "train" C (it is the only "train" now, but we should start with the name of the "train"), select the third vehicle of it - the third from left - and move the pantograph up. The command [PU] is identical with [PDU], it means: both pantograph 1 and 2 up - but this tram has only a single pantograph, then this one will be set up.

The line was too long - you can divide the lines by appending a backslash ( \ ) at the end of each continued line. The movement UNIT is already known - two "trains" will be coupled. The first train is a real train, pulled by a hungarian V43 electric engine. The second "train" is only another V43 engine (with an older livery). The C1 train comes in, in the first wait time ( T1= ) the pantograph is set down: C1.PD. It is importand to address the C1 train for this operation: the C2 "train", the single engine not on the screen yet should not lower its pantograph, it will move soon! After a 2 second wait time the another V43 with the old livery is coming in, stops, and will be coupled with the train. In the second wait time ( T2= ) the second engine's pantograph will be set down too (in Hungary the pantographs are always down, when somebody works on the cables: the two engines should be coupled with each other). After 5 second time only the pantograph of the second engine will be set up ( C2.PBU ) depending on the next moving direction, the train starts with only one engine pulling.

and the doors

At the moment there are only a few vehicles capable to open and close the doors. We will see later, how to draw and define the door animations for the Traffic Screensaver - in this point we use only the predefined doors.

It is similar to the pantograph movements: inside the wait time parameters we can open the doors with he OPEN and close the with the CLOSE command. We can address the doors with the "train" code, sequence number of the vehicle (the engine counts too, even if it doesn't have movable doors), and the number of the door. OPEN means to open all the doors on the line. C1.OPEN opens the doors of the C1 "train". C1.2.OPEN opens all the doors of the second vehicle (counted from left) of the C1 "train",

This tramway stops, all the doors will be opened, the pantograph on the first coach goes down. After 5 seconds the pantograph on the other end goes up, the doors will be closed, and the tram goes back.

This tram stops, only the first door opens, closes, and the tram starts. The vehicles are counted in from left to right. The doors are counted in the sequence they are defined in the macro of the vehicle - usually in the Stock List. The convention is to define them from left to right. So, the 3. vehicle from left is the first in the moving direction, the 3. door from left is the first from the head of the tram in the moving direction.

Foreground-background

The picture set of the Traffic Screensaver is collected from several sources, several authors. Some of them are transparent pictures, others are opaqe. If you intend to place pictures before other pictures, you must assure, that the picture closer to you is transparent, allowing you to see through. If you have a transparent picture of a building, a tree, you can place it in the foreground, and let every vehicle to run behind it - including the opaque ones. If you have transparent engines and coaches, you can let them to run before a background picture - even if the background picture is opaque.

The foreground and background picture is the relative of the way code. You can specify the way in the $LINE, $GROUP, $SECTION, $PATH commands for a line remaining on the screen (all vehicles will use the same way picture), or - if the way code is missing in the above commands -, you can specify it in each movement; on both places with the W= parameter. The same is true for the foreground and background picture, and you can specify them only on the same place. If you have a W=, BG=, or FG= parameter in your $LINE or segmentation statements, the same parameters has no effect in the movement lines. If you use neither of them in the segmentation commands, you can use some - or all of them - in the movement lines, specifiing the way, catenary, foreground and background pictures selectively for each single movement on this line.

A place a line occupies on the screen can be divided into 3 parts:

The height of the middle part is determined by the stock list - it is the normal height of the catenary (the $IMGY command in the ascii format of the stock list defines this height), it is 58 pixel in the MM&MM compatible size. You can set this parameter in each segmentation command too, it will be inherited inside it.

The size of the upper part is limited by the $ABOVE command or ABOVE= parameter in the timetable file (default: 1 pixel, only for a single line as the catenary), the lower part is limited by the $BELOW command or BELOW= parameter (default: 7 pixel, all the built-in way pictures fit into this size). If you intend to use background or foreground pictures, which are higher, you need to specify the ABOVE and BELOW parameters in the timetable line itself, or in a segmentation command containing the foreground/background definition - these parameters are inherited by the contained lines and further segmentation commands), or in the $ commands for the whole timetable somewhere in your timetable file.

The way - specified by its default value depending on the stock list and $WAY settings - is placed between the background and the foreground picture, it hides the background picture(s), but it is hidden by the foreground picture(s). If you do not need the way picture specified for the vehicles, you can use the W=X; parameter value: X, as way code for nothing, it overwrites the default setting.

The foreground and background picture itself is defined in the FG= or BG= parameter. Let's see some examples:


C=DB_652; BG=TREE3; AB=35;

( AB= is a shorthand form of the ABOVE= parameter, it reserves enough space above the track for the tree).

How to create such screenshots ? If you press the  space  key, Traffic freezes the pictures in the Run window: all the vehicles and animations stop. A second  space  continues the movements. You can make a single step - one step the vehicles would do in 100 ms - by pressing the  1  key. The key  2  key makes 2 steps, the  3  key 3 steps - and so on. So, stopping the train before the tree, and doing some single steps you can achieve the position you like for the picture capture.

The first parameter after the colon determines the horizontal position of the forground/background element, the second parameter the vertical position. The horizontal position is measured in the same way the P= parameter of the movements (the stop position) does it: the first number is the percentage of the window width, and you can add/substract an offset in pixels:


C=DB_652; FG=TREE3:20,-13; AB=35; BL=15;

You can place more elements into a foreground or background parameter. As the individual elements have parameters delimited by commas, the elements should be delimited by semicolons - and therefore the whole definition should be enclosed in parenthesys:


C=M_BZMOTA; BG=(TREE3:20;M_STATION1:40;TREE1:60,-5;TREE1:80); AB=45;

Instead of the names of single pictures you can use complex constructs - the same rules apply, as for the trains. These picture will be placed close to each other - similarly to trains. Let's build a platform from its components:


C=<BR614BBL,BR914BB,BR614BB; AB=55; \
    BG=(TREE4:100-146;30*PLF_DB1:>100; \
    BANK_DB4,LAMP_DB4,BANK_DB4:*100-120,10);

This background is composed from the following elements:

     PLF_DB1
LAMP_DB4
BANK_DB4
TREE4

The platform itself consists of 30 beton elements ( 30*PLF_DB1 ) , which is placed on the right side of the screen ( :>100; ) - the right side of the 30 beton elements is placed to 100% of the window width. The two banks and the lamp with the station table placed near each other ( BANK_DB4,LAMP_DB4,BANK_DB4 ), they are 120 pixels left from then right side of the window ( :*100-120,10 ). Notice the usage of the pixel distance by the station construction! Imagine, if you experiment, and place the lamp to 80% of the window - about the same place, as now - and then you let run the same timetable file full screen, on a 1280 or more wide screen, the lamp will be on the left side of the platform - on that screen a distance of 20% from the right side means 256 pixels.

The elements will be drawn in the same sequence they are defined - if they overlap, the first one will be behind the ones defined later. So, the bank and the table hide a part of the tree.

The first parameter after the colon, the horozontal position can express an interval on the screen - the composed picture will be cut or repeated to fill this interval:


C=GN_SD45B;BG=TRBED1:..,^0;W=X;

The two points delimit the left and right position the picture should be repeated. The default value for the left border is the left side of the window/screen, for the right border the right side of the window/screen - so, omitting both positions, using only the delimiter the picture will fill the full width of the window.

The vertical position of the picture uses the upper alignement: the upper side of the trackbad picture is aligned to the "rail position" - where the vehicles run.

The  W=X;  parameter assures, that the default rail won't cover the picture TRBED1 (remember, the track pictures generated by the  W=  parameter or the default way codde assigned to the vehicles come between the background and foreground picture, so, they cover the background picture).

TRBED1

M=BACK; D=L; C=M_V43R; W=X; AB=50; \
    BG=(TRBED6:5-20+=TrbL..,^0; M_REL:<TrbL=CatL,-5; \
        BOCK1:TrbL+30=>BockR;M_VEZ,M_VB:<CatL..;); \
    P=<BockR;
TRBED6
BOCK1
M_REL
M_VEZ
M_VB

In the above example we had to look at the stock list window in order to determine the width of the M_REL picture - the catenary should be aligned to its left, closing pilon. Similarly, the stop position of the engine needed to be calculated based on the width of the BOCK1 picture. And all these calculations use nothing, when we have a random number in the whole chain - all the following positions cannot use the same random value. To solve these problems, you can name the positions and use their actual value by their names.

The expression 5-20+ invokes the random number generator, placing the left side of the track somewhere between 5 and 20% of the window width. The plus sign on the end of the expression is needed to distinguish from the expression "20 pixel left from 5% of the window width). Sorry, I defined here a confused syntax - the minus sign is used both for interval and for "pixel left from percentage" constructs. Appending the plus sign to the number avoids to accept it as a pixel offset to left, so the general meaning, the interval is used. (The plus sign means + 0 , 0 pixels right from the calculated point).

The part  =Trbl  stores the calculated position for later use under the name TRBL (all the names in Traffic are case insensitive).

The pilon's left side is aligned to the stored position - the left side of the trackbad and rail. It's right side's position - where the catenary wires should connect - is stored under the name CatL.

I wanted to place the BOCK1 picture somewhere under the end pilon, it is aligned on neither sides to the pilon, but it should preserve it's relative position to the pilon. So, the position uses the left side position of the pilon, adding 30 pixels to it. The right side of BOCK1 is the real end of the track a vehicle can use - it is named as BockR.

The catenary is built from the wires and a simple pilon. These two picture near each other will be repeated until they reach the right side of the window (imagine, on a screen with 1600x1200 pixel resolution it means about 3 more pilons of M_VB ). The catenary should be aligned on it's left side - the end pilon should connect to the left side of the wire picture M_VEZ , and not somewhere in the middle - therefore the left side of the interval has the  <  characted showing the left alignement.

Our last task to specify to stopping point for the M=BACK; movement. The left side of the engine shoud stop before the BOCK1 picture - it's right side's position is named BockR.

The expressions inside the BG= and FG= parameters are evaluated from left to right; the evaluation begins with the background expressions, the foreground expressions follow them. The WP= and P= parameters, which specify the points for the movements will be evaluated later. You can use only position names, which are already defined - you can use a point name from the background in your forground expression or defining the stopping point of the trains, but you cannot do it in reverse sense.


C=<OBB_6030_230NL,OBB_7030_230N,OBB_6030_230N; \
    FG=M_B,M_VEZ:..,,0-399;AB=20;

As our timetable file has only a single line, the same line will be repeated. Having the catenaries always on the same position doesn't give a nice result, so, we can shift the "phase" of the repeated pictures by the third parameter behind the colon. Using a random interval equal to the total length of the pictures M_B and M_VEZ the catenary is placed fully randomly on the screen - but it fills the whole screen width because of the  ..  interval.

Segmentation

The Traffic screensaver has a dynamic place allocation strategy on the screen. It gets the next movement from the timetable file (sequentially or in random order is another theme), calculates the height the movement needs on the screen (evaluates the IMGY=, ABOVE=, BELOW= parameters or their inherited default values), and tries to place it randomly in one of the free areas on the screen. If there is sufficient place for the line, it will run: the way or a complete background-foreground picture will be shown, and a movement will be played on it. If the movement is finished, the way (or background) picture is deleted from the screen, the space will be freed for new timetable commands. If there is no sufficient space, Traffic will wait until some movements finish, and there will be enough place to fit on the screen.

A $GROUP is a single line having a fixed place on the screen, but running more movements after each other on that same place. Usually the $GROUP has a common background picture: you will see some movements after each other in the same place. A $GROUP splits the sequence the timetable file lines will be executed. The lines inside the group (between the $GROUP and $ENDGROUP directives) will be obeyed after each other in the space the group occupies. For the lines outside the $GROUP the whole group behaves as a single line: it allocates screen space, and runs for a long time on the same place, occupying the place of a single line.

If you define the background picture in the $GROUP directive, the background remains on the screen during the whole time the $GROUP runs - it is the usual way you want to use this directive. Even if you use the same background definition, if the background is defined in the movement lines, the background picture will be deleted after each movement, and regenerated - shown - before the next movement. The background will flicker in this case.

A $SECTION is a virtual screen. When it runs, it has a fixed place too, and from outside it behaves, as a (perhaps very high) single line. But from inside it behaves as the screen: the lines between $SECTION and $ENDSECTION compete for the screen space inside the section's area, as they do it on the whole screen outside a section. If there is enough height inside the section, it can contain many movements above and below each other.

A $SCENE is comparable with the group - it occupies also a fixed area, it contains usually a common background pictures. You cannot place movements inside a $SCENE directly - the $SCENE contains some $PATH segments. The $PATH segments contain the movements in the usual way. This two-level construct of the $SCENE assures more pathways inside the same environement - usually in the same background. The $PATH pathways can overlap each other, they can even be on the same place, before each other. This construct is for moving the vehicles before - behind each other.

The $LINE segmentation directive is for compatibility purposes. The first versions of Traffic (and the MM&MM screensavers) used a fixed space allocation scheme - the screen was divided into lines on (almost) fixed spaces, each line with the same height and the same distance between the lines. You can use the $LINE directives inside the $SECTION-s, and on the whole screen (in the outmost level). The lines you define will have its fixed space as long as the $SECTION is on the screen (or during the whole run, if they are declared in the outmost level). The space not covered by $LINE directives remains for the dynamic allocation described above. If you use a $LINE directive without a line number, it covers all the lines not explicitely defined by a $LINE directive with a line number, and these lines will share the movements between the $LINE and $ENDLINE directive - the next movement will be obeyed in the next line, which becomes free.

The lines above describe an S-Bahn station with traffic in both direction. The whole segment occupies a height of 110 pixels ( DY=110; ). Both lines are on the same level, fully before/behind each other ( Y=10 ). The first line is near to us (the trains move from left to right on it), the second line is behind it, the trains run there from right to left. The FG= parameter in the first $PATH directive specifies the foreground picture - a pale before the station. Behind it there is the track of this $PATH : the W=3E; parameter lets show a normal rail with catenary (only with a single line; try to change it by a real catenary drawing - insted of the W= parameter it comes then into the FG= or BG= parameter). Behind the first track is the background of this first track and the foreground of the second track. The platform is defined here as the foreground of the second track. Behind the second track there is a building ( BG=MR_SBOX5 ). We have a total of 5 different layers, on two layers run the trains, the 3 other layers are static pictures.

Some small tricks to mention in this timetable fragment: The stopping point of the two track differs slightly, one is P=*50+10; the other is P=*50-10; Both stopping points are in the middle of the screen (remember: *50 means the middle of the trains to the 50% of the screen width), but the track near to us changes it by 10 pixels to right ( +10 ), the line behind it shifts the stopping point to left ( -10 ). So, you can notice, that there are two different trains, even if they stop in the same moment on the station.

The trains themselves are defined in the macro $DEF BR420= - so both direction can use the same set of trains without having to write the whole long random selection into both $PATH segments. Some of the trains are long single pictures, others are combined from 3 pictures, the latter should have the   <   character in the parenthesys fixing the definition direction (the car with the driving cab to left should be always the leftmost unit of the train independently of the running direction).

Without the TB=(3-9); initial waiting time the trains in the both direction will be started approximately in the same time. This parameter shifts the time the trains come in from right by some seconds (a random time between 3 and 9 seconds). In order to have the same follow time between the two directions the other direction has the same waiting time after it's run as TE=(3-9);

If the trains had functioning door animation, you could change the M=STOP; parameter by M=OPEN; in the second line (for the trains running from right to left), as we see the opening doors only for that trains (the platform is in the middle, between the tracks).

The lifetime of the $LINE directive is equal with the $SECTION containing it (or is the full time Traffic runs in case of the outermost $LINE directives), but the other segmentation directives have it's own, limited lifetime. The parameter COUNT= specifies, how many timetable lines will be executed inside the segment until it finishes for this time, the TIME= parameters determines the lifetime in seconds. If you specify neither of them, Traffic executes as many timetable lines, as many are defined inside the segment (if the actual sequence is Fixed from the beginning, Fixed continued or Random sequence, it means, all timetable lines will be executed one time before the segment terminates, but the sequence Random gives no guarantie, as then the lines are executed in fully random manner).

Each segment has its own housekeeping of the contained timetable lines - which is the next, which run already - and this information is preserved between the runs of that segment. If you specify a $GROUP - $ENDGROUP pair, between them 20 movement lines, but the $GROUP directive has the parameter COUNT=5; and the group runs in a fixed sequence, than the group should be started 4 times (the common background image will be shown 4 times), until all the 20 movements will be shown. Inbetween other timetable lines outside the $GROUP definition will occupy the screen.

All the segmentaton directive except $SECTION has a their default height as a single line - it depends on the actual values of the ABOVE=, IMGY= and BELOW= parameters - the height of the upper, the active and the lower area. The $SECTION directive's default height is the height of its parent segment (it's parent section, as only a $SECTION can contain other segments). You can use the $SECTION directive to separate timetable lines from each other based on era, geographical position or some other purposes:

In this timetable example you will see one time only trains pulled by steam engines or only trains from the present times together. After 15 steam era trains the screen will be emptied - the trains leave the screen, no new ones start until the screen is fully empty - then begins a new phase with the actual trains, the first ones start quickly after each other until the screen is "full" with them. After the 15. new train Traffic waits, until all new trains leave the screen, then come the old trains back ... and so on. There can be much more trains than 30 in the timetable, all the trains will run sometimes, but after 15 trains the style changes from old the new and back.

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 the 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 wagon. 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]

Mirroring

Many vehicles has near identical, but not symmentrical left and right sides: the differences, if any exists at all, are smaller to be viewable at the measures 1 pixel = 10 cm.


KAMION12

KAMION12[M]

A conditional expression ensures, that the truck moves with its head to the front, depending on the moving direction:

But there are other vehicles having texts, drawings on them:


KAMION21

KAMION21[M]

to solve this problem you can select some areas in the vehicle picture, which will be "mirrored back" after the mirroring:


KAMION21[>M:30,12,120,27]

The parameters after the colon: horizontal position of the square mirrored back - the position is measured in the original state, not on the already mirrored picture -, vertical position of the square area, width and height. Vertical position is measured from the bottom of the picture upwards, beginning with 0 - as usual in the Traffic Screensaver.

You can include the coordinates of more areas after the colon in the [M: ... ] command:


KAMION25

KAMION25[>M:28,21,26,13,56,24,34,8]

the text and the picture on the sidewall is mirrored back independently in its place.

Many vehicles (included the trucks) have this mirroring command already in their Stock List macro: you can use them in both moving directions. There are some vehicles - mostly steam engines - where there are noticable differences between the left and right side of the vehicle. The pictures in the Stock List are defined with the mirroring command - in this case, the [R] command. The [R] command is identical with the [M] command, the only difference: the [R] command reverses the phase picture sequence, assuring, that the wheels of the mirrored picture are rotating in the correct manner. You can select in the configuration window of the Traffic Screensaver, menu entry Special -> Use Default Direction, that the moving direction of timetable lines including such vehicles should be the default (the drawn) direction of the vehicle: if the Stock List macro has a [<M] or [<R] command, the moving direction will be from left to right, if it contains [>M]or [>R] commands, then from right to left. This menu entry has no influence on timetable lines, which contains an explicit direction parameter (D=L; D=R; etc.), in this cases the vehicle picture will be mirrored, if needed.

A vehicle family

Let us create vehicle pictures for the DB 401 ICE engines - the original version and the version with the additional pantographs for Switzerland, in the original livery with the purple/red stripe and the actual version with only the red stripe, right and left headed too:

The following base pictures are needed for this vehicle family:

BR401CH: the most complicated version: two-color stripe, two pantographs
the red stripe - it is in the opposite direction, never mind
ICEWINL: the window of the driver's cabin with the shadow, if the vehicle is headed left
BR401P1 and the pantograph up

Let's begin with the old swiss version headed right, we must specify only the pantographs in their up position. The right pantograph is the mirrored version of the left one, therefore a # character precedes the picture name in the second [E] command [E:#BR401P1,37,38]

 
BR401CH[E:BR401P1,13,38][E:#BR401P1,37,38]

To get normal version (with a single pantograph) we need to "delete" the first pantograph - to let it's squere filled with the background color (and of course there is only one pantograph for animation):


BR401CH[BT:37,38,22,5][E:BR401P1,13,38]

Let them turn left! As these vehicles are symmetric, we can simply mirror them [M:]. We should let unmirrored (or said in other way, to mirror back) the sign on it [M:87,20,28,14]. As the shadow on the window looks different, we cover the window with the correct picture detail [O:ICEWINL,24,27]. The pantographs are the same, only the positions are shifted:


BR401CH[M:87,20,28,14][O:ICEWINL,24,27][E:BR401P1,147,38][E:#BR401P1,171,38]

The left-headed simple pantograph version is the combination of the above, note, that the [BT:147,38,22,5] command covering the spare pantograph uses the mirrored coordinates, as the [BT] command is after the [M] command.


BR401CH[M:87,20,28,14][O:ICEWINL,24,27][BT:147,38,22,5][E:#BR401P1,171,38]

The new livery is created by replacing the purple-red stripe with a red only stripe (as the little squares, the DB emblem has another size in the both pictures, we cannot reach the red-stripe-only version by coloring the purple pixels to white). As the red stripe is drawn in the mirrored version, we let to use it's mirror by preceding the BR401NRO picture name with #:


BR401CH[O:#BR401NRO,3,9][E:BR401P1,13,38][E:#BR401P1,37,38]

The most complicated case is the new livery with one pantograph headed left:


BR401CH[M:87,20,28,14][O:ICEWINL,24,27][O:BR401NRO,0,9][BT:147,38,22,5][E:#BR401P1,171,38]

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 pixel. 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, 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.

Animations

Animation means to quickly change the phase pictures of a small area in the vehicle picture. Animated can be everything you can imagine: pantographs, doors, windows, people, smoke etc. You can draw a child opening a window, leaning out, and at the end closing the window. There are two basic types:

The basic type of the animated pictures is the first - the "one shot" animation. There are special cases for the doors and pantographs controlled with reserved verbs, which act as a two-state switching animation.

The animation is a single picture containing all the phase pictures. They can be near each other, above each other; even it is possible, that the parts defining each phase pictures are overlapped.

This is a zoomed picture of a door movement (it is the M_BZM0B picture from the stock list, belonging to the hungarian BZMOT diesel railcars). The animation is placed in a 19 pixel wide, 28 pixel high square area - the door opening, and the wagon side near the opening the door moves to. There are 10 different phases drawn near each other.

The programming of an animation is divided into two or three parts

The animation definition is made by the [A: ] command:

Let's see all the parameters:

DOOR The name of the animation. For some special, two state animations the names are fixed (DOOR for doors, PAN for pantographs).
M_BZM0B The picture name of the animation containing all the phases.
112 The horizontal position of the animated square area in pixels in the vehicle. The coordinates begin with 0 at the left side.
3 The vertical position of the animated square area in pixels in the vehicle. Vertical positions are measured from the bottom, the coordinates are beginning with 0.
19 The width (in pixels) of the animated square area, it is the width of the phase pictures too.
28 The height (in pixels) of the animated square area, it is the height of the phase pictures too.
0 The horizontal position of the first phase picture inside the animation picture.
0 The vertical position of the first phase picture inside the animation picture.
20 The time (in 10 milliseconds) between the phase pictures.
10 The total number of the phase pictures.
19 The horizontal distance of the next phase picture from the previous inside the animation picture. This number can be a negative number - it means, the picture are coming from right to left.
0 The vertical distance of the next phase picture from the previous one.

If you can use the same animation picture on different places - for example, more identical doors of a single vehicle, or the same door of several vehicles of a vehicle family - the most part of this parameters is the same, only the first two, the position of the animation squer inside the vehicle picture can vary. Therefore you can define the common parameters in the Stock List at the animation picture:

The name of the command at the animation picture should be identical with the name of the animation.

You start the animations in the waiting time parameter of the timetable file rows, the name of the animation (not the name of the animation picture) starts it from the beginnig to the end:

The light diesel railcar BZMOT comes in, stops, the right door opens - and after 5 seconds the railcar starts with opened doors! This type of animation start - with the name of the animation - always starts from the first picture, plays all phase pictures and ends with the last picture.

We could define a second animation based on the same animation picturs:

and start the animations with the two different names:

If we omit the last W command in the T= parameter, the closing of the doors will be started, but the vehicles starts too - the doors will be closed by moving vehicle. As some railway coaches close their doors in this way, you need this possibility too.

Look at the second animation, the DOOR_CLOSE in the BZMOT0 vehicle definition line: the only difference to the DOOR_OPEN movement is the start coordinate - the coordinate of the last, 10th picture -, and the negative step direction: the same movement is played backwards.

As the door opening - closing is a possibility intended to used often in the Traffic Screensaver, there is a special extension for the doors. If you define a movement with the name DOOR, the commands OPEN and CLOSE act on it. The OPEN command playes the states toward the end position, the CLOSE commands playes them backwards. The starting phase is the actual phase! If a door is already closed, a repeated CLOSE command doesn't play the whole sequence once more, it leaves the door unmoved. You can even open or close a door halfway (as some trams make it, when the door doesn't closed perfectly:

What should happen ? The first CLOSE command closes the doors. After all 9 doors of the tram are closed, the first door (as the tram moves from left to right, but the coaches and the doors are numbered from left to right independently from the moving direction) starts to open. 10 phase pictures, each step in 200 ms - in 1 second the door will be only half way opened, and then will be closed. Of course, we could draw a special animation picture with a door opening only some pixels and then closing back - but does this way cost much more work, doesnt it ?

What could be done with this type of animations ? Almost everything, what is limited inside a vehicle picture. There is a picture in the Stock List with a man climbing down from one door of an electrical engine, walking near the engine, and climbing up at the other end of the engine. Loading - unloading, people getting off and going downstairs, interne movement in the coaches seen through the windows - there are many interesting possibilities. If you have an idea, draw it - and let us see it!

Pantographs

We have seen already, how to set up the pantographs, when an engine comes in into the screen, and how to move them, when the engine is staying.

The basic way to define a pantograph animation is the same as for other animations described above, the animation name should be PAN . You can use the [E:<picture name>, ... ] instead of the [A:PAN,<picture name>, ... ] modifier to define the pantograph animation - in this case this is only an abbreviation.

The pantograph states are much more important, as the smooth movement by changing this state. Therefore there are two special ways to define a simple animation, which consists of only the two end states - pantograph down and up.

The general way is to draw the vehicle with all pantographs down, and then then to draw the single pantographs in the state up:

There are many electric engine pictures abroad drawn for the MM&MM screensaver: they consist of a full picture having the left pantograph up, and an upper part - usually only the different par, the vehicle roof with the pantographs - which shows the right pantograph up, the left one down. The expression

ENGINE<ENGINE_SAR

originally meant: if the vehicle moves from right to left, the screensaver overwrites the upper part of the ENGINE picture with the ENGINE_SAR picture: the right pantograph will be up. Now the Traffic Screensaver cuts the ENGINE_SAR picture in the middle into two parts, the corresponding area of the ENGINE picture on the same parts, and each half will be a pantograph animation. This way works with the usual electric engines having their pantographs on the left and right side. If you have a special vehicle - mostly electric railcars, or for example the two-system engine of the ICE engine, which have on one side both pantographs, this trick doesn't work.

--- 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 Traffic screensaver homepage