2TallTyler wrote: ↑02 Jun 2020 22:25Andy, any plans to dust off this tutorial with an explanation of how to import data from a separate file?
Not so much
The general trend for templating newgrf has been to import something like a .csv file, or similar. I think the idea is that it's easier for non-technical contributors.
I tried that for FISH, in a few different ways using .cfg files.
Now I just declare everything directly in python files and import those.
Using non-python file formats inevitably requires dealing with escapes, and parsing data types (e.g. strings vs integers, strings vs. lists) etc.
It's not hard to open and parse a .csv file. Something like yaml or json might also be a valid route.
But I'd be inclined to put values in python dicts or classes and just import them.
The FIRS approach is probably too complex as a starting point, but the cargos are the simplest example
https://github.com/andythenorth/firs/bl ... os/acid.py
That uses a Cargo class which provides many benefits, but could have just been a dict in a simpler world.
If you're doing houses, you could probably put them all in one python file, houses.py or so, with house_1 = {keys, values}, house_2 = {keys, values} etc. Then you just import houses.py to your main script, and you use it as houses.house_1[key] or houses.house_1.items() or whatever you need for the case you have.
Hope that helps, happy to expand.