Scripts

From OpenTTD
Jump to: navigation, search


It is possible within OpenTTD to write Scripts which can be used to automate specific tasks. Unfortunately at present this functionality is a little buggy, but it does work.

Scripts comprise regular console commands, with the commands being run in sequence.

An example script:

echo "Starting server"
script openttd.log
net_frame_freq = 1
name "My Server"

If we then save the above script as .openttd/scripts/on_dedicated.scr, it will be run whenever a dedicated server is started, and do the following:

  • It will Print "Starting Server" in the console window
  • It will begin logging the non-debuging output from the console window to openttd.log
  • net_frame_freq will be set to 1
  • The server name will be set to "My Server"


If you want scripts to automatically run whenever you start a client, see here. To run scripts manually, simply use the exec command from the console.

Personal tools