So I was having issues with other methods to "patch" (as I call it) pnml files into the one nml file that NMLC can read.
So I decided to write my own "patcher" myself in Python (sounding like a good idea as NMLC already needs python), and since I think I've made it robust enough I believe I should share it with the community!
Download link!
I'm distributing it under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
So far it can read references from pnml files (#include "example.pnml") to patch together and use custom variable definitions for reference in the code (#define CUSTOM_DEFINITION 288).
The rest will just be written directly to the nml file to be compiled.
The definition does NOT currently work with function-like definitions.
Please give any feedback, it is much appreciated
I hope you enjoy!
Edit 26 05 18: Use the download link above, includes full example and license
NML Py-Patcher - a pre-compiler written in Python 3
Moderator: Graphics Moderators
- FulliAutomatix
- Engineer
- Posts: 119
- Joined: 24 Aug 2014 12:20
- Location: Kaon Prison, Cybertron
NML Py-Patcher - a pre-compiler written in Python 3
Last edited by FulliAutomatix on 26 May 2018 22:43, edited 3 times in total.
Some links to stuff I've made:
-=RUKTS=- | -=NML Py-Patcher (a Python 3.0 pre-compiler)=- | -=Screenshots=- | -=Doom Soundtrack port to OpenTTD=- | -=Heightmaps collection=-
-=RUKTS=- | -=NML Py-Patcher (a Python 3.0 pre-compiler)=- | -=Screenshots=- | -=Doom Soundtrack port to OpenTTD=- | -=Heightmaps collection=-
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: NML Py-Patcher - a pre-compiler written in Python 3
This is pretty neat. Didn't want your thread to just pass by silently.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: NML Py-Patcher - a pre-compiler written in Python 3
You're god man
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
- peignenappe
- Engineer
- Posts: 9
- Joined: 15 Jul 2022 19:59
- Location: France
Re: NML Py-Patcher - a pre-compiler written in Python 3
Hi ! Thanks a lot for this tool, this is really awesome
I wonder if there is a way to define multiple lines at once, something like :
Instead of :
That would be a little easier to read, is there a way to do that ?
I wonder if there is a way to define multiple lines at once, something like :
Code: Select all
#define COMMON_PROPERTIES {
climates_available: ALL_CLIMATES;
track_type: ELRL;
}
Code: Select all
#define COMMON_PROPERTIES climates_available: ALL_CLIMATES; track_type: ELRL;
-
- Engineer
- Posts: 117
- Joined: 04 Apr 2022 12:44
- Location: The openttd discord server
Re: NML Py-Patcher - a pre-compiler written in Python 3
I don't know if NML py-patcher supports it or not but in other nml pre-compilers you can use
to separate lines.
Code: Select all
\
to separate lines.
Who is online
Users browsing this forum: No registered users and 15 guests