NML - a Newgrf Meta Language
Moderator: Graphics Moderators
- planetmaker
- OpenTTD Developer
- Posts: 9432
- 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.Alberth wrote: 29 Dec 2019 11:19 It's a Python program, so you can just take the NML source, get a Python3 interpreter, and run the code.
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: 9432
- 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: 268
- 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: 268
- 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
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- 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: 268
- 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
My Scenarios:
Archipiélago Hermoso (Latest Release: Version 3.2)
Turnpike Falls (Latest Release: Version 0.91)
Re: NML - a Newgrf Meta Language
I'm trying to reimplement the stockpile limits in a fork of 3iff's SPI, but I'm having a hard time figuring out how to get it to work properly.
So, I have this industry that requires WORK and [ENSP or TOOL]. I want it to stop accepting workers (or any other cargo) if incoming_cargo_waiting("WORK") >= 40. I have established the appropriate callbacks in both the industry and tile definitions, but while it actually stops taking new workers, it does not allow the industry to receive any other cargo.
Any idea how to solve this?
Relevant code Screenshot
So, I have this industry that requires WORK and [ENSP or TOOL]. I want it to stop accepting workers (or any other cargo) if incoming_cargo_waiting("WORK") >= 40. I have established the appropriate callbacks in both the industry and tile definitions, but while it actually stops taking new workers, it does not allow the industry to receive any other cargo.
Any idea how to solve this?
Relevant code Screenshot
Re: NML - a Newgrf Meta Language
Here is a simple example:Sunmannus wrote: 05 Jun 2021 01:46 I'm trying to reimplement the stockpile limits in a fork of 3iff's SPI, but I'm having a hard time figuring out how to get it to work properly.
https://dev.openttdcoop.org/projects/ec ... orage.pnml
Re: NML - a Newgrf Meta Language
Thank you for your reply and for the link.McZapkie wrote: 05 Jun 2021 14:01 Here is a simple example:
https://dev.openttdcoop.org/projects/ec ... orage.pnml
As far as I can see, there are no significant differences between the code in ECSext and the one I have been using as a guide (OGFX Manpower Ind and SPI). And actually, the code works (it limits the reception of the selected cargo when the stockpile limit is reached), but the problem is still that it does not allow to receive any of the other cargoes defined by that same tile.
I think I can work around the issue if I define different industry tiles for each type of cargo the industry requires, but in a set with 60+ industries receiving 3-5 raw materials on average it's not really an option. I'll give it some more thought, but if so I'll have to drop that feature.
Re: NML - a Newgrf Meta Language
Yes, you need to have separate tiles for separate cargo to switch them on/off.
Re: NML - a Newgrf Meta Language
Hi! I'm trying to make a long tram (15m) using 3.3 px/m scale, so it's 50 px in length. Adding a second car (multiple unit), I'm facing a problem that length 8 is not enough - rear car overlaps with front one. Is there any way to fix this?
- Attachments
-
- ktm5m3.png (9.73 KiB) Viewed 8461 times
-
- 2ktm5.PNG (9.49 KiB) Viewed 8461 times
Re: NML - a Newgrf Meta Language
You need to add third part, invisible.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Who is online
Users browsing this forum: Google Feedfetcher, UnicycleBloke and 12 guests