How to make a NewGRF properly ?
Moderator: Graphics Moderators
How to make a NewGRF properly ?
Hey,
I've learned NML in the last days and i'd want to start with a small NewGRF.
I searched information but i didn't find where i could create a NewGRF in just one file.
I've learned NML in the last days and i'd want to start with a small NewGRF.
I searched information but i didn't find where i could create a NewGRF in just one file.
Re: How to make a NewGRF properly ?
https://www.tt-wiki.net/wiki/NMLTutorial/
This should explain everything you need to know about making a NewGRF in NML and compiling the code.
Start at the very top of the list. Compilation is one of the first things in the Tutorial.
This should explain everything you need to know about making a NewGRF in NML and compiling the code.
Start at the very top of the list. Compilation is one of the first things in the Tutorial.
Re: How to make a NewGRF properly ?
I've seen this, but it still doesn't tell me how i make this directory structure in the Language Tutorial.
Re: How to make a NewGRF properly ?
The directory structure (basically)
/(NewGRF file):
Here should be:
(NewGRF name).nml
Possibly the compiler
/(NewGRF file)/lang:
Here should be:
english.lng
(Other language).lng
/(NewGRF file)/gfx:
This is where your graphics should be, possibly sorted into sub-folders
/(NewGRF file)/sfx:
You can have sounds, but don't need them.
You can have other various sub-folders for graphics, and .pnml files. .pnml files have parts of the full .nml, but must be compiled into the (NewGRF name).nml. If you need me to clarify slightly, just ask.
Sent from my SM-G935F using Tapatalk
/(NewGRF file):
Here should be:
(NewGRF name).nml
Possibly the compiler
/(NewGRF file)/lang:
Here should be:
english.lng
(Other language).lng
/(NewGRF file)/gfx:
This is where your graphics should be, possibly sorted into sub-folders
/(NewGRF file)/sfx:
You can have sounds, but don't need them.
You can have other various sub-folders for graphics, and .pnml files. .pnml files have parts of the full .nml, but must be compiled into the (NewGRF name).nml. If you need me to clarify slightly, just ask.
Sent from my SM-G935F using Tapatalk
Re: How to make a NewGRF properly ?
Can it be a normal directory ? And how to compile then the directory into a NewGRF ?
Re: How to make a NewGRF properly ?
Assuming you're on Windows:
https://www.tt-wiki.net/wiki/NMLTutoria ... sing_NML_3
Just have a folder like this:
and then you can just use:
and this will give you MMT.grf. Nothing more, nothing less. You can then drop this file into C:\Users\USER\Documents\OpenTTD\newgrf
https://www.tt-wiki.net/wiki/NMLTutoria ... sing_NML_3
Just have a folder like this:
and then you can just use:
Code: Select all
nmlc -c --grf MMT.grf MMT.nml
Re: How to make a NewGRF properly ?
Where to get all those other files ? I only have lang and gfx.
And the GRF file is the NML file but i need to change the extension or it's something else ?
And the GRF file is the NML file but i need to change the extension or it's something else ?
Re: How to make a NewGRF properly ?
This tells me you had a total disregard for my first message and in fact did not follow the tutorial. The tutorial starts with the installation of nml, which will get you the other files.acs121 wrote:Where to get all those other files ? I only have lang and gfx.
And the GRF file is the NML file but i need to change the extension or it's something else ?
EDIT: https://www.tt-wiki.net/wiki/NMLTutoria ... ling_NML_3
Re: How to make a NewGRF properly ?
I did get nmlc.exe before creating the topic. I simply didn't know those files were from that file.
Re: How to make a NewGRF properly ?
So youve jumped straight to the download link and ignored the rest. Go read the tutorial again.acs121 wrote:I did get nmlc.exe before creating the topic. I simply didn't know those files were from that file.
Re: How to make a NewGRF properly ?
Man, my answer was given now. Let me work, please, you that posted "I almost get the impression you are running around the forums telling everyone to do stuff for you. At some point you should really just bite the bullet and do it yourself". I'm just biting the bullet and doing it myself here, and you're complaining. Appreciate things at their just value.
Re: How to make a NewGRF properly ?
I did type nmlc -c --grf ***.grf ***.nml and it told me this :Erato wrote:Assuming you're on Windows:
https://www.tt-wiki.net/wiki/NMLTutoria ... sing_NML_3
Just have a folder like this:
and then you can just use:and this will give you MMT.grf. Nothing more, nothing less. You can then drop this file into C:\Users\USER\Documents\OpenTTD\newgrfCode: Select all
nmlc -c --grf MMT.grf MMT.nml
Usage : nmlc [options] <filename>
Where <filename> is the nml file to parse
nmlc : error : Error : only a single nml file can be read per run
I give you the screen of the GRF file.
- Attachments
-
- 2018-03-14 (14).png
- (79.77 KiB) Not downloaded yet
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How to make a NewGRF properly ?
Don't use ***acs121 wrote:I did type nmlc -c --grf ***.grf ***.nml and it told me this :
Give the actual nml filename.
This is saying "don't use ***".nmlc : error : Error : only a single nml file can be read per run
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)
Re: How to make a NewGRF properly ?
I am using *** instead of the nml file name/GRF file name.
Re: How to make a NewGRF properly ?
Have you read this in the tutorial:
Looking at the screenshot of your setup I can see a space in the .nml itself and maybe you also have spaces in the path/directory to it...
Try using underscores: _ Rather than spaces.
Code: Select all
Note that if you have any spaces in a directory or file name, you need to enclose that complete path or filename in double quotes, e.g.: cd "D:\Users\Username\My Documents\mygrf".
It is therefore recommended not to have any spaces.
Try using underscores: _ Rather than spaces.
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.
Re: How to make a NewGRF properly ?
Huge thanks Quast. You saved me.
Re: How to make a NewGRF properly ?
Uh, now it gives me this :
C:\Users\User\Desktop\Alstom RegioCitadis>nmlc -c --grf AlstomRegioCitadis.grf AlstomRegioCitadis.nml
[Knmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: v6379:afad0c76c40b from 2017-06-19
Error: (ValueError) "Unknown format code 'r' for object of type 'str'".
Command: ['nmlc', '-c', '--grf', 'AlstomRegioCitadis.grf', 'AlstomRegioCitadis.nml']
Location: File "nml\grfstrings.py", line 971, in handle_grflangid
C:\Users\User\Desktop\Alstom RegioCitadis>nmlc -c --grf AlstomRegioCitadis.grf AlstomRegioCitadis.nml
[Knmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: v6379:afad0c76c40b from 2017-06-19
Error: (ValueError) "Unknown format code 'r' for object of type 'str'".
Command: ['nmlc', '-c', '--grf', 'AlstomRegioCitadis.grf', 'AlstomRegioCitadis.nml']
Location: File "nml\grfstrings.py", line 971, in handle_grflangid
Re: How to make a NewGRF properly ?
I am guessing now...
What happens if you also remove the space in the directory name?
(this may affect certain paths to for example gfx in your .nml, be sure to change those too then if necessary)
What happens if you also remove the space in the directory name?
(this may affect certain paths to for example gfx in your .nml, be sure to change those too then if necessary)
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.
Re: How to make a NewGRF properly ?
It didn't do much things.
Re: How to make a NewGRF properly ?
My guess would be that there is an issue with your .lng file, in particular, the first line that defines the grflangid. Looking around in the nmlc code...
Line 971 is . What I think is happening here is that your grflangid isn't valid and nmlc really wants to tell you that your grflangid is bad but the error message raises another exception about the "{:r}" which is what gets reported to you.
Code: Select all
def handle_grflangid(self, data, pos):
"""
Handle a 'grflangid' pragma.
@param data: Data of the pragma.
@type data: C{str}
"""
if self.langid is not None:
raise generic.ScriptError("grflangid already set", pos)
lang_text = data[1].strip()
value = LANG_NAMES.get(lang_text)
if value is None:
try:
value = int(lang_text, 16)
except ValueError:
raise generic.ScriptError("Invalid grflangid {:r}".format(lang_text), pos)
if value < 0 or value >= 0x7F:
raise generic.ScriptError("Invalid grflangid", pos)
self.langid = value
self.check_expected_plural(None)
Code: Select all
raise generic.ScriptError("Invalid grflangid {:r}".format(lang_text), pos)
Who is online
Users browsing this forum: No registered users and 17 guests