HowTo/Debug Scripts

From TrainzOnline
< HowTo
Revision as of 13:47, 21 September 2018 by S301 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Some recommended steps to help with Debugging custom scripts for TRS19 can be found below:

  • Configure a minimal test session.
  • Enable developer mode in the Dev tab of the Trainz Settings.
  • Enable script logging in the Dev tab of the Trainz Settings.
  • Enable script message logging in the Dev tab of the Trainz Settings.
  • Enable display of script exceptions in the Dev tab of the Trainz Settings.
  • Restart the game if necessary.
  • Add Interface.Log() statements throughout your code so that you can determine what is being called, and in what order. Log the start of functions and any relevant control flow (if statements, return statements, etc.)
  • Clear your logs.
  • Launch directly into your session from CM to avoid unnecessary additional log entries.
  • Proceed until the problem occurs (hopefully this is immediate).
  • Pause the game.
  • Open the logs window.
  • Review the output, to see which of your logs have fired off and which messages have been dispatched.


Additionally for TRS19, with "Maximise Compatibility" enabled in the Dev tab of the Trainz Settings, the script environment will generally be very similar to T:ANE SP2/3 and you shouldn't need to make any real changes for.

If you run a route that is setup to run in 'maximise performance' mode (or have TRS19 set to 'maximise performance'), then you may need to make changes to your script. See Asynchronous Route Streaming for further information.

Personal tools