Various NML related questions
Moderator: Graphics Moderators
Re: Various NML related questions
Yes, that's what I found (and suspected). Setting production to 0 per cycle generates 180-225t/month (45t per treecut instance). If I set production to 10 per cycle (256 ticks) I get 800t per month!
I would support some change. I might like a flag that cut trees but didn't produce anything - that could be handled by 'normal' production settings every 256 ticks. That would make the tree cutting a cosmetic effect and the lumber mill (or whatever industry is the source) be able to produce cargo regardless of whether there are local trees to cut or not.
That essentially is what I was aiming for but it was just an experiment that currently doesn't work. I didn't realise it was a can of worms.
If there are any changes in this area I'd appreciate being kept up to date...and I'm happy to beta test anything should that be needed.
I would support some change. I might like a flag that cut trees but didn't produce anything - that could be handled by 'normal' production settings every 256 ticks. That would make the tree cutting a cosmetic effect and the lumber mill (or whatever industry is the source) be able to produce cargo regardless of whether there are local trees to cut or not.
That essentially is what I was aiming for but it was just an experiment that currently doesn't work. I didn't realise it was a can of worms.
If there are any changes in this area I'd appreciate being kept up to date...and I'm happy to beta test anything should that be needed.
Re: Various NML related questions
Hi,
I'm trying to create a rail track with smooth curves using nml. What I'm trying to achieve is automatically changing the sprite of connected rail depending in the change of direction eg. Track NE connected to track N, they both change their sprite to create a smooth edges of tracks.
Is it possible a railpiece can detect the type of the other railpiece connected to them?(maybe an example will help)
If someone already created a smooth trackset it can be more helpful to see their source.
I'm trying to create a rail track with smooth curves using nml. What I'm trying to achieve is automatically changing the sprite of connected rail depending in the change of direction eg. Track NE connected to track N, they both change their sprite to create a smooth edges of tracks.
Is it possible a railpiece can detect the type of the other railpiece connected to them?(maybe an example will help)
If someone already created a smooth trackset it can be more helpful to see their source.
Fromerly known as Alon
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Various NML related questions
No, that's currently not possible. You cannot read the tracks directions of adjacent tiles. IIRC, one of the main reasons is the performance impact this might have on the game - but my memory might be fuzzy there.Alon wrote: 22 May 2020 03:27 Is it possible a railpiece can detect the type of the other railpiece connected to them?(maybe an example will help)
That said, a solution similar to how canals/rivers are handled can be envisioned in form of some patch series / pull requests to OpenTTD's source code. But that would need to go through much scrutiny as tracks are much more abundant and there's more track types than water types as the latter cannot be user-defined)
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: Various NML related questions
Curved track would also need to affect where trains running on it are drawn, and players would probably begin requesting more rotation sprites for the trains too.
Re: Various NML related questions
That is not a problem, extra rotation sprites are now used in some Trainset grfs like CETS(which is unavailable) and Polish PKP set 2.0(partially supports additional rotation sprites). For normal trainsets a parameter or checks should be made to disable the curved tracks.jfs wrote: 22 May 2020 17:36 Curved track would also need to affect where trains running on it are drawn, and players would probably begin requesting more rotation sprites for the trains too.
That's why I came up an idea to create a trackset with smooth curves, for Trainset that support extra rotation sprites.
Conclusion: if that's really possible someone should have done the similar idea before. Maybe in future this can be implemented.
Fromerly known as Alon
- TrainLover
- Engineer
- Posts: 107
- Joined: 01 Jul 2015 15:03
Re: Various NML related questions
I was finally able to figure out how to setup a MakeFile, but whenever I use it, I keep getting an unexpected token in header.pnml. Do you know what is happening and how I could fix it?
Developer of North American Passenger Liveries: viewtopic.php?f=26&t=87228
Re: Various NML related questions
Remember "pnml" is a Python script, not an NML file, you need to have it run with the correct version of Python.
- 2TallTyler
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- Contact:
Re: Various NML related questions
Is it? I've always seen them used to hold a portion of the NML code, which is combined by a Python script (.py extension) into one long NML file, then that merged file is processed with NMLC into the .grf. The file extension is somewhat arbitrary, possibly meaning "pre-nml" or "partial-nml".jfs wrote: 17 Jun 2020 16:33 Remember "pnml" is a Python script, not an NML file, you need to have it run with the correct version of Python.
This is how my projects are set up, although I use .nml rather than .pnml as my arbitrary file extension. My makefile is a Windows Batch file (.bat) which simply runs the Python script, then NMLC, then moves the completed file to my OpenTTD NewGRF directory. For reference, here is a project repository with explanatory comments in the admittedly-flawed makefile.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Various NML related questions
For all projects I meddled with that's not correct (and that's probably the majority where you find files with that extention). In those cases it's an nml file which still needs pre-processing; thus it needs running it through the cpp pre-processor in order to handle some macros expansion and including further source files.jfs wrote: 17 Jun 2020 16:33 Remember "pnml" is a Python script, not an NML file, you need to have it run with the correct version of Python.
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: Various NML related questions
Hello,
I've been trying to access "num_vehs_in_vehid_chain" through "var[0x61, 0, 0x00FF0000, 0x41]" - but I'm always getting a CB_FAILED/default response (nothing in the range 1-256). I have been able to use "var[0x61, 0, 0x000000FF, 0x41]" to obtain the "position_in_vehid_chain" - and figured moving the "FF" over to the position as shown in the nfo format and debug panel would work just as well but I get nothing.
Is my formatting here wrong or am I trying to access something that I shouldn't be? I have tried it both ways round as well - running 0x000000FF before 0x00FF0000...but 0x00FF0000 is not happy.
Code Snippets:
I've been trying to access "num_vehs_in_vehid_chain" through "var[0x61, 0, 0x00FF0000, 0x41]" - but I'm always getting a CB_FAILED/default response (nothing in the range 1-256). I have been able to use "var[0x61, 0, 0x000000FF, 0x41]" to obtain the "position_in_vehid_chain" - and figured moving the "FF" over to the position as shown in the nfo format and debug panel would work just as well but I get nothing.
Is my formatting here wrong or am I trying to access something that I shouldn't be? I have tried it both ways round as well - running 0x000000FF before 0x00FF0000...but 0x00FF0000 is not happy.

Code Snippets:
Regards,
Tinny/Tintinfan.
Tinny/Tintinfan.

Re: Various NML related questions
Well, it looks like after a little bit more digging that "var[0x61, 16, 0x000000FF, 0x41]" does the trick - or at least seems to do the trick, not sure if luck or logic but this document helped.Tintinfan wrote: 20 Jun 2020 09:40 Hello,
I've been trying to access "num_vehs_in_vehid_chain" through "var[0x61, 0, 0x00FF0000, 0x41]" - but I'm always getting a CB_FAILED/default response (nothing in the range 1-256). I have been able to use "var[0x61, 0, 0x000000FF, 0x41]" to obtain the "position_in_vehid_chain" - and figured moving the "FF" over to the position as shown in the nfo format and debug panel would work just as well but I get nothing.
Is my formatting here wrong or am I trying to access something that I shouldn't be? I have tried it both ways round as well - running 0x000000FF before 0x00FF0000...but 0x00FF0000 is not happy.![]()
Code Snippets:
Regards,
Tinny/Tintinfan.
Tinny/Tintinfan.

Re: Various NML related questions
Well, OK then, let's step this through what each of these does, and why one works and the other doesn't.Tintinfan wrote: 21 Jun 2020 07:16 Hello,
I've been trying to access "num_vehs_in_vehid_chain" through "var[0x61, 0, 0x00FF0000, 0x41]" - but I'm always getting a CB_FAILED/default response (nothing in the range 1-256).
[...]
Well, it looks like after a little bit more digging that "var[0x61, 16, 0x000000FF, 0x41]" does the trick
so you check var 41 (via var 61), which is apparently bitstuffing several BYTE values into one DWORD (i haven't checked which ones, but it doesn't matter), so var 41 will return a number like 0xaabbccdd.
so the var[num, shift, mask, parameter] syntax will first shift the result, and then apply a mask.
in var[0x61, 0, 0x00FF0000, 0x41] the result will be shifted by 0, intermediate result will be 0xaabbccdd
and then apply a mask of 0x00FF0000, so the result will be 0x00bb0000
in var[0x61, 16, 0x000000FF, 0x41] the result will be shifted by 16, intermediate result will be 0x0000aabb
and then apply a mask of 0x000000FF, so the result will be 0x000000bb
Re: Various NML related questions
Is it possible to check for tracktype if neighboring tile is station or not? I don't see such variables on nml tracktypes page, not sure if it is even implemented.
I would like to check such condition to change graphic of catenary: individual pole for standalone tracks vs gantry in case of stations larger than 1 track.
I would like to check such condition to change graphic of catenary: individual pole for standalone tracks vs gantry in case of stations larger than 1 track.
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.
Re: Various NML related questions
I don't know if for sure, butMcZapkie wrote: 01 Oct 2020 08:42 Is it possible to check for tracktype if neighboring tile is station or not? I don't see such variables on nml tracktypes page, not sure if it is even implemented.
I would like to check such condition to change graphic of catenary: individual pole for standalone tracks vs gantry in case of stations larger than 1 track.
on page : https://drive.google.com/drive/folders/ ... QdUFegEqTr
view files : m4nfo_stations... & CZTR_Stations.nfo
maybe it's implemented there
probably not CZTR_RAILS.nml : https://drive.google.com/drive/folders/ ... FNGV19hMkk
-
- Traffic Manager
- Posts: 174
- Joined: 07 Sep 2020 15:12
- Location: Usually near some interesting rail systems. :P
Lights related question
Hi all,
I am making a new version of my train grfs, and I have this question: is there something, which could disable animating of animated colours? I would like to not animate lights of my EMU. Now, I have two versions of parts with lights: front part has brightest and darkest colours from cycle of runway lights, while the back part has crossing cycle colours. I would like, to have them not animating, because animating of these makes no sence... I have tried to look at some source codes, but I know about only one set, which I think, has that working, but it does not have public source. (french narrow gauge trains)
All help from you welcomed.
greets MLG
I am making a new version of my train grfs, and I have this question: is there something, which could disable animating of animated colours? I would like to not animate lights of my EMU. Now, I have two versions of parts with lights: front part has brightest and darkest colours from cycle of runway lights, while the back part has crossing cycle colours. I would like, to have them not animating, because animating of these makes no sence... I have tried to look at some source codes, but I know about only one set, which I think, has that working, but it does not have public source. (french narrow gauge trains)
All help from you welcomed.
greets MLG
Are you an eye candy player? Check out Invisible engine set! viewtopic.php?f=67&t=88934
You can write to me in English, or Czech. Můžete mi psát česky nebo anglicky.
Formerly known as MLG.
You can write to me in English, or Czech. Můžete mi psát česky nebo anglicky.
Formerly known as MLG.
- 2TallTyler
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- Contact:
Re: Various NML related questions
There is a flag in the sprite block for whether a sprite is animated or not. I don’t know if it actually disables the animation or just changes whether NML gives a warning.
A better option would be to simply change the color to a non-animated color.
A better option would be to simply change the color to a non-animated color.
Re: Lights related question
2TallTyler wrote: 25 Oct 2020 14:01 There is a flag in the sprite block for whether a sprite is animated or not. I don’t know if it actually disables the animation or just changes whether NML gives a warning.
A better option would be to simply change the color to a non-animated color.
Indeed, use other colors (that are close to the ones that animate).
Or, code in 32bpp colors. They wont animate unless you use a MASK-file with those colors.
The flag 2Talltyler wrote about is (I think) just to disable the NML warning, it does nothing else.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604
Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
-
- Traffic Manager
- Posts: 174
- Joined: 07 Sep 2020 15:12
- Location: Usually near some interesting rail systems. :P
Re: Lights related question
Okay, I will change colours to some others.Quast65 wrote: 25 Oct 2020 18:16 Indeed, use other colors (that are close to the ones that animate).
Or, code in 32bpp colors. They wont animate unless you use a MASK-file with those colors.
And doing 32bpp graphics requires some 3d modelling software (blender,...), while I do not have any expierence with them. And, for me, it is not perfect, when you have everything in 8bpp, and huh, a 32bpp train.

Are you an eye candy player? Check out Invisible engine set! viewtopic.php?f=67&t=88934
You can write to me in English, or Czech. Můžete mi psát česky nebo anglicky.
Formerly known as MLG.
You can write to me in English, or Czech. Můžete mi psát česky nebo anglicky.
Formerly known as MLG.
Re: Lights related question
This is actually not true. 32bpp refers to not being limited to a certain palette. See here for a more detailed explanation of 32bpp and extra zoom.MLG wrote: 26 Oct 2020 08:00 And doing 32bpp graphics requires some 3d modelling software (blender,...), while I do not have any expierence with them. And, for me, it is not perfect, when you have everything in 8bpp, and huh, a 32bpp train.![]()
viewtopic.php?f=26&t=83238
If you use 32bpp, then the colour you wanted to use won't be animated, because it won't be associated with that spot on the palette that refers to an animated colour.
Here's a page in the tutorial about how to implement it:
https://www.tt-wiki.net/wiki/NMLTutorial/32_bit_sprites
https://www.tt-wiki.net/wiki/NMLTutoria ... it_sprites
Re: Various NML related questions
Is it possible to define default track type in menu (not the first one)?
Let say I have 3 tracktype, Slow, Medium, Fast, they appear in menu in such order,
any means to force Medium to be first choice when track menu is opened?
Let say I have 3 tracktype, Slow, Medium, Fast, they appear in menu in such order,
any means to force Medium to be first choice when track menu is opened?
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: No registered users and 12 guests