TPL Commands

For a complete listing of all TPL commands with more extensive descriptions, details, and examples, download the TPL help file/manual tpl_help.zip.

Equipment Control Commands

Command

Description

ENGINES: Controls the operation of one (or more) engines.
This command is used to set the speed and control the auxiliary function (lights, TELEX, etc.)

Example - ENGINES: 3/5/0, 11/8/1, 42/M/1, 72/R
This would set engine #3 to a speed of 5 (function off), engine #11 to a speed of 8 (function on), engine #42 to a speed of "medium" (function on), and reverse engine #72.

SWITCHES:

SIGNALS:

Sets the position of one (or more) solenoids.

Example - SWITCHES: 1/r, 5/g
This would set solenoid #1 to red (or curved) and #5 to green (or straight).

SOUND: Plays a designated .WAV sound file. There's an option to allow a sound file to "loop" or play continuously.

Example - SOUND: whistle
This will play the file "WHISTLE.WAV" using the PC's sound card and speakers.

The new beta version of TPL supports the playing of up to 8 sound files simultaneously!

BEEP: Causes a "beep" to play through your PC speaker or sound card. This is helpful if you want one of your routes to signal you that it is at a certain point in its sequence:

Example - BEEP:

SASWITCH: Saves the position of all solenoids (signals & switches) as they are presently set to a file on the hard disk. This file can then later be loaded (either manually or by the LDSWITCH: command) to reset all solenoids to their previously saved positions.

Example - SASWITCH: startup
This will save the current position of all solenoids to a file named "startup".

LDSWITCH: Loads a pre-defined set of solenoid (switch & signal) settings, and sets all solenoids to their respective positions.

Example - LDSWITCH: startup
This will read the previously saved file named "startup" and quickly reset all solenoids to their desired positions.

Timing & Detection Commands

Command

Description

PAUSE: Causes execution of the route sequence to suspend operation.

Example - PAUSE: 5
Execution of this route will not process any commands for 5 seconds.

DETECT: Causes execution of the current route to suspend until a contact track section is tripped.

Example - DETECT: 15
This would cause execution of the route to suspend until detector #15 was tripped.

CLEAR: Causes execution of the current route to suspend until a contact track section is cleared.

Example - CLEAR: 42
This would cause execution of the route to suspend until detector #42 was cleared.

RESET: Resets a contact track section to a "cleared" state. This is used prior to a DETECT: command to ensure that a contact track shows clear, even if it was tripped sometime in the past.

Example - RESET: 14
This would clear contact track #14 just in case a train had been occupying it. A subsequent DETECT: would only show contact if a train were still on this track section.

WSWITCH:

WSIGNAL:

Causes execution of the current route to suspend until a contact track section is cleared.

Example - WSIGNAL: 13/g
Execution of the current command sequence will be suspended until signal #13 is green.

IF_SWITCH:

IF_SIGNAL:

Executes the next command only if the condition is true.

Example - IF_SWITCH: 11/r
The command immediately following this one will be executed only if switch #11 is set to the curved position. Otherwise the next command will be skipped.

IF_DETECT: Executes the next command only if the condition is true.

Example - IF_DETECT: 31
The command immediately following this one will be executed only if contact track section #31 is tripped. Otherwise the next command will be skipped.

IF_CLEAR: Executes the next command only if the condition is true.

Example - IF_CLEAR: 31
The command immediately following this one will be executed only if switch #31 clear (not tripped). Otherwise the next command will be skipped.

ANDDETECT:
ORDETECT:
IFADETECT:
IFODETECT:

ANDLCEAR:
ORCLEAR:
IFACLEAR:
IFOCLEAR:

These new commands provide powerful new ways to use track detectors and s88 decoder modules.

ANDDETECT evaluates several detectors and, only if they are ALL tripped, will execution of the command sequence proceed.
ORDETECT also evaluates several detectors. In this case, if any ONE detector is tripped will command sequencing continue.
IFADETECT works like ANDDETECT, and works with the IF-ENDIF and IF-ELSE-ENDIF constructs (see below).
IFODETECT works like ORDETECT, and works with the IF-ENDIF and IF-ELSE-ENDIF constructs (see below).

The ANDCLEAR, ORCLEAR, IFACLEAR, and IFOCLEAR commands work like their DETECT counterparts, but evaluate detector tracks for cleared, as opposed to tripped, conditions.

These commands add tremendous flexibility and allow easier, more complete control than ever before!

IF-ENDIF
&
IF-ELSE -ENDIF

The latest beta version of TPL now supports IF-ELSE-ENDIF structures, so the following programming is possible:
IF_DETECT: 15     ;if an engine is in the station
SWITCH: 11/r ;route it to another track
SOUND: trk1 ;announce that the train is on track #1
ELSE
SOUND: trk2 ;announce that the train is on track #2
ENDIF

You can even nest conditions (up to 10 levels deep) to support even the most complex train routing logic:

IF_DETECT: 15        ;if track #1 is occupied
  IF_DETECT: 16      ;if track #2 is occupied too
    IF_DETECT: 17    ;if track #3 is also occupied
      ENGINE: 42/0/1 ;stop the engine
      CALL: WAIT     ;"WAIT" is the name of a route
                     ; which will wait for an open track
ELSE:
SWITCH: 11/r,13/g ;route the train to track #3
ENDIF: ELSE: SWITCH: 11/r,13/r ;route the train to track #2 ENDIF: ELSE: SWITCH: 11/g ;route the train to track #1 ENDIF:

FOR-NEXT
LOOPS

The latest beta version of TPL also supports FOR-NEXT structures, so the following programming is also possible:

This section of code will "count" the number of times a train passes a certain point (detector #12). After the 5th time, processing will continue to the commands after the NEXT: statement.
FOR: 5     ;execute this loop 5 times
CLEAR: 12 ;wait for train to clear this detector
DETECT: 12 ;wait until this detector is tripped NEXT: --- more commands

You can also nest conditions (up to 10 levels deep), and even tell TPL to do something different for certain situations:

FOR: 3                ;execute the outer loop 3 times
  CLEAR:  12          ;wait for train to clear this detector
  DETECT: 12          ;wait until this detector is tripped
  FOR: 2              ;execute the inner loop 2 times
    CALL: SWITCHER1   ;move cars in the switchyard
    IF_LOOP: 2        ;if 2nd time through the inner loop,
      CALL: SWITCHER2 ;  then call a second switching routine
    ENDIF:
  NEXT:
  IF_LOOP: 3          ;if this is the 3rd (last) time through
; the inner loop,
SOUND: BELL ; then play a sound file "BELL.WAV" SIGNAL: 42/R ; and set switch #42 to RED ENDIF: NEXT:

Using FOR-NEXT loops can greatly reduce the size of your command files!



TRON:
&
TROFF:

Now, if you're having a little trouble figuring out what's happening on your layout, there's a way for TPL to report back to you which commands are executing and in what order!

TRON: (TRace ON) When this command is placed within a command file, all future commands will be "echoed" to a window for you to review. This way you can see exactly the sequence of instructions as they are executing, as well as the result of any conditional ("IF") statements. You can turn on this feature for several (or all) routes at the same time.

TROFF: (TRace OFF) Causes the tracing process to stop; commands are no longer displayed in the debugging window.

Route Transfer & Control Commands
GOTO: Causes sequencing of the current route to stop and transfers control (starts) another route.
START: Starts the sequencing of another route.
RESTART: Restarts the command sequence for the current route.
CALL: Temporarily transfers control to a different route. Once the "called" route has completed its sequence, control is returned to the current route. If the "called" route is busy at the time this command is executed, you can instruct TPL to either wait until it is free, restart the called route immediately, or by-pass its execution entirely.
SUSPEND: Suspends the operation of another route.
RESUME: Resumes the operation of another route.
TERM: Causes the execution of the "termination" section of another route. Each route can have a special set of commands that only gets executed if called from another route (or the TPL main screen). This termination section can be used, for example, to stop a route's sequencing and return all trains to the station.
CANCEL: Cancels the operation of another route.

|| Return to the Introductory letter || Return to FAQ's || Return to the Home Page ||