NML - a Newgrf Meta Language
Moderator: Graphics Moderators
- planetmaker
- OpenTTD Developer
- Posts: 9420
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
Not necessarily.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
It is more convenient to me through Linux ubuntu to make.
Re: NML - a Newgrf Meta Language
hi, anyone kindly enough to provide me a win32 build of nml 0.5.X ?. I want to try some of its new features (16-cargo industry support) but I'm unable to compile it myself.
Many thanks
Many thanks
Re: NML - a Newgrf Meta Language
It's a Python program, so you can just take the NML source, get a Python3 interpreter, and run the code.
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: NML - a Newgrf Meta Language
I think I managed to install it, but... ehmm, I'm not sure how to use it now.
I have to move my entire newgrf project folder to this directory from now on?
Also, I have to re-install it every time? I mean, write the
Code: Select all
pip3 install nml
Code: Select all
python setup.py install
Sorry for bothering you
Re: NML - a Newgrf Meta Language
The most basic form is to specify an .nml file that you want compiled, as inI think I managed to install it, but... ehmm, I'm not sure how to use it now.
Code: Select all
python the/path/to/nmlc something.nml
nml has more options to steer it, try "nmlc --help" for more options you can specify (although most are quite exotic except for the --grf option, but you get that by default already, no need to specify it).
Obviously, typing that "python the/path/to/nmlc something.nml" commandline everytime you want to compile an nml file is a hassle, so make a .bat file with that line in it, and run that .bat file instead. If you have spaces in filenames or paths with spaces in them, surround them with double quotes (or remove the spaces from the name). Nowadays, Windows has powershell as well, so that is another way to achieve less typing. No clue how that works though, last time I used a Windows system was in the previous century.
The "pip" and "python setup install" commands are for installing the stuff, you only need to do that once (I have no idea what it does at a Windows system, but Python tends to have adequate docunentation, so try your chances there if you want to know.)
Being a retired OpenTTD developer does not mean I know what I am doing.
- planetmaker
- OpenTTD Developer
- Posts: 9420
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
As a quick summary as to what currently should get you going with NML, also on windows as on any other system:
NML is a python programme and as such does not need being compiled for any operating system - you will always be fine by installing python on your system and then executing setup.py from the nml repository. See also the three posting above here
Basically:
NML is a python programme and as such does not need being compiled for any operating system - you will always be fine by installing python on your system and then executing setup.py from the nml repository. See also the three posting above here
Basically:
- Install python3.6 or later
- download NML source repository
- install libraries:
- python -m pip install pillow
- python -m pip install ply
- optionally install NML as administrator from command line: python setup.py install
- execute nml from command line: python the/path/to/nmlc something.nml
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
This is an example, in case someone needs to know how to do that last step...planetmaker wrote: ↑03 Feb 2020 10:04 As a quick summary as to what currently should get you going with NML, also on windows as on any other system:
NML is a python programme and as such does not need being compiled for any operating system - you will always be fine by installing python on your system and then executing setup.py from the nml repository. See also the three posting above here
Basically:
- Install python3.6 or later
- download NML source repository
- install libraries:
- python -m pip install pillow
- python -m pip install ply
- optionally install NML as administrator from command line: python setup.py install
- execute nml from command line: python the/path/to/nmlc something.nml
Code: Select all
python C:\TTDTools\NML\nmlc C:\TTDTools\GRFs\GRRS\source\src\grrs.nml
I have Asperger's, please be easy on me about stuff. My apologies if I've been a problem for you in the past.
- stefino_cz
- Transport Coordinator
- Posts: 257
- Joined: 02 Jul 2015 08:05
- Location: Czech Republic
- Contact:
Re: NML - a Newgrf Meta Language
Hi,
I still need a help with NML instalation. I'm able to start command
but in the end I get information that libraries are not installed. So I tried start cmd, moved to NML master folder and set
But no result. The first what I know is, that
In case of python -m pip... I get no result (nothing happen) or information that it is unknown command (I think-not sure now). SO I think that the problem is in python but I don't know what I do wrong.
I installed python v 3.7.4 for Win 64bit. Thanks for the help
I still need a help with NML instalation. I'm able to start command
Code: Select all
setup.py install
Code: Select all
python -m pip install pillow
or
python -m pip install ply
Code: Select all
python setup.py install
...do nothing but
setup.py install
...works with an error in the end
I installed python v 3.7.4 for Win 64bit. Thanks for the help

Re: NML - a Newgrf Meta Language
Hi guys!
Is already planned in NML for road- and railtypes can do nearby tile request too? Bw: nearby_tile_class. When don't, than pleas do it!
THX
Is already planned in NML for road- and railtypes can do nearby tile request too? Bw: nearby_tile_class. When don't, than pleas do it!

- stefino_cz
- Transport Coordinator
- Posts: 257
- Joined: 02 Jul 2015 08:05
- Location: Czech Republic
- Contact:
Re: NML - a Newgrf Meta Language
Hi, I need help with part of industry code. When I try to compile it, this error appears
Have somebony any idea where is the problem? It's interesting that with old NML compilator it works so it seems that there is some new feature?
thanks
Code: Select all
nmlc ERROR: "CZTR_INDUSTRY.nml", line 2052: Syntax error, unexpected token "0"
Code: Select all
//Global bonuses
2051 //Option 1 (one year production)
2052 produce(produce_bonus_1, 0, 0, 0, current_year /100, 0);
2053
2054 //Option 2 (gradual processing)
2055 produce(produce_bonus_2,
2056 max(waiting_cargo_1 / 10, 45), max(waiting_cargo_1 / 10, 45), max(waiting_cargo_2 / 10, 45),
2057 min(waiting_cargo_1, max(waiting_cargo_1 / 10, 16)) + min(waiting_cargo_1, max(waiting_cargo_1 / 10, 16)) + min(waiting_cargo_2, max(waiting_cargo_2 / 10, 16)),
0);
//Option 3 (combination)
produce(produce_bonus_3, max(16, waiting_cargo_1 / 10), max(16, waiting_cargo_2 / 10), 0, 10 + ( ( current_year - 1850 ) /15 ) + 2*(min(16, waiting_cargo_1)) + 2*(min(16, waiting_cargo_2)), 0);
thanks

- 2TallTyler
- Transport Coordinator
- Posts: 265
- Joined: 11 Aug 2019 18:15
- Location: Massachusetts, USA
- Contact:
Re: NML - a Newgrf Meta Language
Are you using NML 0.5? The syntax for the Produce block now requires square brackets which weren't present in 0.4 and before.
- stefino_cz
- Transport Coordinator
- Posts: 257
- Joined: 02 Jul 2015 08:05
- Location: Czech Republic
- Contact:
Re: NML - a Newgrf Meta Language
Yeah, this is the problem. Thnaks a lot2TallTyler wrote: ↑03 Jul 2020 17:22 Are you using NML 0.5? The syntax for the Produce block now requires square brackets which weren't present in 0.4 and before.

Re: NML - a Newgrf Meta Language
I've updated the first post to link here instead:
https://github.com/OpenTTD/nml/releases
https://github.com/OpenTTD/nml/releases
Newest screenshots published January 9, 2019
Chrill's scenarios:
Archipiélago Hermoso (Latest Release: Version 3.2)
Turnpike Falls (Latest Release: Version 0.91)
Who is online
Users browsing this forum: No registered users and 2 guests