Page 1 of 1

NML Py-Patcher - a pre-compiler written in Python 3

Posted: 11 May 2018 18:10
by FulliAutomatix
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 :P

I hope you enjoy!

Edit 26 05 18: Use the download link above, includes full example and license

Re: NML Py-Patcher - a pre-compiler written in Python 3

Posted: 21 May 2018 17:00
by andythenorth
This is pretty neat. :D Didn't want your thread to just pass by silently.

Re: NML Py-Patcher - a pre-compiler written in Python 3

Posted: 22 May 2018 17:59
by Tony Pixel
You're god man :bow: :bow: :bow:

Re: NML Py-Patcher - a pre-compiler written in Python 3

Posted: 16 Jul 2022 15:30
by peignenappe
Hi ! Thanks a lot for this tool, this is really awesome :D

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;
}
Instead of :

Code: Select all

#define COMMON_PROPERTIES climates_available: ALL_CLIMATES; track_type: ELRL;
That would be a little easier to read, is there a way to do that ?

Re: NML Py-Patcher - a pre-compiler written in Python 3

Posted: 16 Jul 2022 18:29
by Brickblock1
I don't know if NML py-patcher supports it or not but in other nml pre-compilers you can use

Code: Select all

\

to separate lines.