www.trainplayer.com SupportNewsAboutContact
TrainPlayer Scripting Contents
 Welcome to the TrainPlayer Scripting Page

Your guide to TrainPlayer Scripting, a hobby within a hobby!

What Is Scripting?

A script is a series of instructions for operating a layout. It may contain commands to drive trains, throw switches, set preferences, execute menu commands, make decisions -- pretty much everything needed to choreograph a complex operation, then play it back and watch it all run automatically. Scripting is the activity of designing and developing these things.

This page provides a home base for those who develop scripts or would like to learn how to.  Come on in!  There are some easy ways to get started.  Anyone with the DYI mentality of a model railroader will find it fun and challenging.

But this page is not just for the script producers, it is also for the consumers -- those who enjoy railroad ops and don't mind working for a computerized boss.  Scripting has evolved to a point where it can be used to generate random switching orders, provide interactive instructions, monitor progress, provide rewards on completion.  Try some of the newest layouts, and behold the state of the art. 

What's New

Version 6.3 (Mar 2016) introduced a series of new scripting features along with a great new set of game layouts and a whole new framework for creating them.

New scripting features in 6.3 include:

  • Command Prompt: enter one-line commands for immediate execution -- very handy for developing, debugging
  • New variables, functions, properties: track labels, crash counter, car label display, expanded view controls, notes
  • Improved script editing: new text pane in script windows with consistent menus and keyboard shortcuts
  • Growing subroutine library: many useful new subroutines, automatic update on program start

For more, see the 6.3 Features Page.  For a detailed history of all features, see the TrainPlayer Version History.

New scripted layouts are at two levels:

  • Switch Games: layouts giving you switching challenges, scripted with automatic instructions, monitoring
  • DOG Games: randomly-generated switch games created by the new Directed Ops Generator system

For complete descriptions and lists of games, see the TrainPlayer Guide To Games.

Basic Documentation

Basic information about scripting is found in the TrainPlayer manual.  Here is a web-based copy of the complete Scripting chapter:

About Scripting Introduction and terminology
Scripting UI Devices Dialogs, menus, windows associated with scripting
Working With Scripts Managing, creating, editing scripts
How to Get Started in Scripting Suggestions for getting into the subject
TP Programming Language Guide to the language, command reference

Note: some of the links inside these chapters will not work.  If you get a "page not found" error, it is looking for a page not duplicated on the web.

A better reference for commands and language details is in the Reference tab of Script Central.  The info in this tab is always up to date and guaranteed to match the program capabilities.

Advanced Documentation

Richard Fletcher has provided an excellent series of detailed documents about scripting -- how it works and how to do it.  Required reading by any serious student of the subject.

An Introduction to the TrainPlayer Programming Language An overview of the user interface, history and principles of scripting -- great place for a new user to start
A Guide to the TrainPlayer Programming Language Full guide to the language, rules, and syntax with examples
Scripting Junction Coal Part 1 Guide to automating Eric Twickler's Junction Coal to Big Flats Power
Scripting Junction Coal Part 2 Guide to converting the automated Junction Coal into an interactive layout
TrainPlayer 6.1 - Extensions to the Trainplayer Programming Language Details of new features added in 6.1
Simplified Scripting with Subroutines A description of subroutines and how to use them, with a guide to the first subroutine library
About a DOG All about the Directed Ops Generator

Samples and Games

The TrainPlayer data folders contain a large and growing collection of scripted layouts -- so many that we have created a special page for them: the TrainPlayer Guide to Games

On that page are three annotated lists of layouts:

  • Switch Games: scripted one-time switching challenges, listed with degree of difficulty and time to completion
  • DOG Games:  multi-use state-of-the-art switching challenges, listed with degree of difficulty
  • Scripts and Puzzles: samples of scripting from older, simpler days

As indicated in the guide, some of the layouts in these folders are provided by the installer, and can be found in your local layout chooser; others are available for download in your web chooser.

Where To Go For Help

If you think you would like to get further into scripting, join our Yahoo forum and chat with the experts.  It's a friendly group with a vast knowledge of the subject. 

If you are already into it and running into difficulties, drop us a line: info@trainplayer.com.  We're glad to help.

Feel free to write if you have suggestions for further enhancements.

What Is Scripting?
What's New
Basic Documentation Advanced Documentation Samples and Games
Where To Go For Help

  Copyright 2005 - 2014, TrainPlayer Software