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 can be found here::
- Switch Games: layouts giving you switching
challenges, scripted with automatic instructions, monitoring
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:
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.
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 two annotated lists of layouts:
- Switch Games: scripted
one-time switching challenges, listed with degree of
difficulty and time to completion
- 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
https://trainplayerforum.groups.io/g/Users
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.
|