Game script

OpenTTD allows you to write your own Game Scripts. These scripts can provide goals for all companies, inspect properties of all companies and also communicate with the players of companies.

Feature availability
OpenTTD Manual
Installation · FAQ
Tutorials and Instructions
Game interface ·


Signals · Stations · Junctions · Carrying capacity · Rail Designs & Tips
Roadways · Tramways · Waterways · Airports · Landscaping
Trains · Road vehicles · Ships · Aircraft · Orders
Game options · Settings · AI settings · Custom graphics (NewGRF) · Cheats · Command line
Graphics and sound
OpenGFX · OpenMSX · OpenSFX
More topics
Climates · Towns · Industries · Economy · Disasters · Tips · Hidden features · Hotkeys · Console · Game Mechanics · Multiplayer · Scenario editor · Online content
Troubleshooting · Links

Gamescript or NoGo provides the possibility of adding goal-based scripts to the game via a framework similar to the NoAI framework using the Squirrel programming language.

'Game Scripts' can modify the way towns behave, delete objects, place new in-game industries, and town buildings, as well as inquire about the state of the game, and do several other in-game actions. Game Script files may be downloaded and selected for activation prior to creation of a new game in order to introduce these features. Unlike Advanced Settings which may be changed part way through a game, Game Scripts should be installed prior to starting a new game in order to ensure correct operation. Game Scripts are not supported by TTDPatch, and are introduced, and supported by, OpenTTD version 1.2.0 and later.

For common issues with Game Scripts, visit the Game Script FAQ


Getting Game Scripts

Online content

The most common and convenient way to obtain Game Scripts is by using the ingame online content download feature. Most Game Scripts can be found there. There exists also a Game Script forum where you may find development versions of some Game Scripts.

Manual install

If you want to use Game Scripts installed from other locations, which are not available from the online content download, you need to manually install them into the correct place. A Game Script is either a tarball or .tar file, or a directory with several code files. To install a Game Script:

  1. Download the Game Script file(s).
  2. Move (and uncompress) the Game Script file(s) to the Game Script directory of your OpenTTD installation.
  • This will often be:

C:\My Documents\game (Windows 95, 98, ME)

C:\Documents and Settings\<username>\My Documents\OpenTTD\game (Windows 2000, XP)

C:\Users\<username>\Documents\OpenTTD\game (Windows Vista, 7, 8, 10)

~/.openttd/game (Linux, BSD)

~/Documents/OpenTTD/game (OSX)

Activating Game Scripts

1. In the main menu, click "AI/Game Script Settings".

2. Select the text in the box under "Game Script"

3. Click the top-left-most button in the bottom menu labeled "Select Game Script"

4. Pick a Game Script of your choice from the pop-up menu.

Setting Game Script parameters

1. In the main menu, click "AI/Game Script Settings".

2. Select the text in the box under "Game Script"

3. Click the 'Configure' button.

4. A row of parameters defined by the Game Script will show up. Change the desired parameters and click the 'Close' button to implement the changes. Use the 'Reset' button to set all parameters back to default values.

Writing your own Game Script

When you write a Game Script, you code it in a programming language called Squirrel. The framework used for Game Scripts is called NoGo and share many aspects with the AI framework called NoAI.

For historical reasons there are plenty of wiki articles on how to write AIs, but very few with the Game Script perspective. Thankfully Game Scripts are very similar to AIs only that they don't have ownership of a specific company. Thus the AI articles are still of great help on how to write Game Scripts.

When working with your GS you should store your files in $OpenTTD/game. Make a directory there for your GS eg. $OpenTTD/game/myGS and put the .nut files in there. Note that you should not store them in $OpenTTD/online_content/game as that the online_content directory is managed by OpenTTD and may overwrite your files etc.

External links