Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Jun 23, 2018 11:54 am

All times are UTC




Post new topic  Reply to topic  [ 36 posts ]  Go to page 1 2 Next
Author Message
PostPosted: Thu Jan 25, 2018 7:45 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
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.

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Thu Jan 25, 2018 8:03 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Mon May 25, 2015 9:09 am
Posts: 262
Location: The Netherlands
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.

_________________
No pics no clicks. Seriously.
ImageImageImage


Top
   
PostPosted: Thu Jan 25, 2018 8:16 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
I've seen this, but it still doesn't tell me how i make this directory structure in the Language Tutorial.

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Thu Jan 25, 2018 8:32 pm 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 579
Location: London (South West)
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


Top
   
PostPosted: Thu Jan 25, 2018 9:19 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
Can it be a normal directory ? And how to compile then the directory into a NewGRF ?

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Thu Jan 25, 2018 9:35 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Mon May 25, 2015 9:09 am
Posts: 262
Location: The Netherlands
Assuming you're on Windows:
https://www.tt-wiki.net/wiki/NMLTutoria ... sing_NML_3

Just have a folder like this:
Image
and then you can just use:
Code:
nmlc -c --grf MMT.grf MMT.nml

and this will give you MMT.grf. Nothing more, nothing less. You can then drop this file into C:\Users\USER\Documents\OpenTTD\newgrf

_________________
No pics no clicks. Seriously.
ImageImageImage


Top
   
PostPosted: Thu Jan 25, 2018 9:54 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
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 ?

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Thu Jan 25, 2018 11:45 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Mon May 25, 2015 9:09 am
Posts: 262
Location: The Netherlands
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 ?

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.

EDIT: https://www.tt-wiki.net/wiki/NMLTutoria ... ling_NML_3

_________________
No pics no clicks. Seriously.
ImageImageImage


Top
   
PostPosted: Fri Jan 26, 2018 8:33 am 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
I did get nmlc.exe before creating the topic. I simply didn't know those files were from that file.

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Fri Jan 26, 2018 6:03 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Mar 19, 2009 7:25 pm
Posts: 2604
Location: Kent
acs121 wrote:
I did get nmlc.exe before creating the topic. I simply didn't know those files were from that file.


So youve jumped straight to the download link and ignored the rest. Go read the tutorial again.

_________________
Image


Top
   
PostPosted: Fri Jan 26, 2018 6:33 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
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.

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Wed Mar 14, 2018 3:44 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
Erato wrote:
Assuming you're on Windows:
https://www.tt-wiki.net/wiki/NMLTutoria ... sing_NML_3

Just have a folder like this:
Image
and then you can just use:
Code:
nmlc -c --grf MMT.grf MMT.nml

and this will give you MMT.grf. Nothing more, nothing less. You can then drop this file into C:\Users\USER\Documents\OpenTTD\newgrf


I did type nmlc -c --grf ***.grf ***.nml and it told me this :
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

_________________
All my sprites (in CC or 2CC) are available here.
Top
   
PostPosted: Wed Mar 14, 2018 4:00 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4676
Location: Lost in Music
acs121 wrote:
I did type nmlc -c --grf ***.grf ***.nml and it told me this :

Don't use ***

Give the actual nml filename.

Quote:
nmlc : error : Error : only a single nml file can be read per run

This is saying "don't use ***".

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (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, released)


Top
   
PostPosted: Wed Mar 14, 2018 4:12 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
I am using *** instead of the nml file name/GRF file name.

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Wed Mar 14, 2018 4:46 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sun Oct 09, 2011 1:51 pm
Posts: 1538
Location: The Netherlands
Have you read this in the tutorial:
Code:
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.

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.

_________________
Projects: viewtopic.php?f=26&t=57266
Screenshots: viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.


Top
   
PostPosted: Wed Mar 14, 2018 5:13 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
Huge thanks Quast. You saved me. :bow:

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Wed Mar 14, 2018 6:52 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
Uh, now it gives me this :
C:\Users\User\Desktop\Alstom RegioCitadis>nmlc -c --grf AlstomRegioCitadis.grf AlstomRegioCitadis.nml
nmlc 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

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Wed Mar 14, 2018 8:29 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sun Oct 09, 2011 1:51 pm
Posts: 1538
Location: The Netherlands
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)

_________________
Projects: viewtopic.php?f=26&t=57266
Screenshots: viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.


Top
   
PostPosted: Wed Mar 14, 2018 8:36 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Nov 03, 2017 6:57 pm
Posts: 863
Location: Courbevoie, near Paris, France
It didn't do much things.

_________________
All my sprites (in CC or 2CC) are available here.


Top
   
PostPosted: Thu Mar 15, 2018 9:28 pm 
Offline
Engineer
Engineer

Joined: Wed May 24, 2017 12:51 pm
Posts: 20
Location: East Texas
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...
Code:
    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)


Line 971 is
Code:
raise generic.ScriptError("Invalid grflangid {:r}".format(lang_text), pos)
. 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.

_________________
Unless otherwise stated, all my code is GPL v2.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 36 posts ]  Go to page 1 2 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.