[Request] NML - Simple Tutorial for Changing Town Names

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
DestroNK
Engineer
Engineer
Posts: 4
Joined: 28 Mar 2016 02:21

[Request] NML - Simple Tutorial for Changing Town Names

Post by DestroNK »

Hello Everyone.

I would like to create a simple Newgrf for personal use, which creates new Town Names - and I have also found a lot of sources.
Most of them suggest to use NML for creating a set of Town Names, and I've also found examples
Likes This: http://newgrf-specs.tt-wiki.net/wiki/NML:Town_names
or This: https://github.com/Ketsuban/random-engl ... _names.nml

Since I'm a programmer myself (Job) I'm doing pretty easy with that source code, and I can also understand the basics
of them without problems. My Problem is handling NML, and implementing the created GRF into OpenTTD.

So first of all - can anybody give me a short - but well explained introduction about how exactly using the NML tool?
The Documentation about how to use it has big lacks and is in my opinion very user unfriendly. I created such a
Source file (as posted above) and didn't know in what way to save it. As Txt? As Grf? As Nml? What kind of
File extension do I need? (I tried it with .nml) My next problem is the usage itself. I downloaded the Last Version of the NML Program.
Inside of it, there was only a exe which opened a CMD window, which closed immediatly.

Ok, so not being too dumb I used cmd, cd'd into the directory of NML and executed the .exe file, with the filename of the
.nml file as Parameter, which I previously put into the same directory. First of all was a strange Message about a missing language file.
What kind of Language file? And why is it missing, when I just downloaded the entire tool? So I kept browsing and
found a example file, which I just put in, without knowing what it did. After that I had a few Errors inside the
.nml and language file, which I also figured out somehow, by commenting the lines, which were not working out, using // as it is usual in C# and C++

Then I managed to get a .grf file out of it, which I tried to implement everywhere in my documents/openttd folder, without
any kind of success ......... No matter where I put it, it just didn't show up in the NewGRF file List.

So can anyone help me out and explain the points I posted here? It is very hard for a person that didn't work with it,
and very user unfriendly. I just want to create a small variation of custom town Names. What do I have to do?
I'd prefer a short step-by-step introduction, if possible :)

Thanks for the (hopefully) incoming help^^
Greetings, DestroNK
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [Request] NML - Simple Tutorial for Changing Town Names

Post by planetmaker »

You should put the resulting NewGRF also in the correct location... you need to place it in the NewGRF folder obviously. See OpenTTD's readme (as programmer you know where to find that: next to your OpenTTD binary is also a version of the readme. Or find it similar to how you find NML's tutorial, the description, that an NML project consists of at least an NML and a language file, as found as in basically all other example NewGRFs).

However, while you're at it and as you now went through it: please feel invited to extend the documentation exactly there where you find it lacking. It's a volunteer project. Complaining that it should get better, without telling what is missing where while all info actually is there won't make it better - it needs you to amend it where *you* perceive it missing.
DestroNK
Engineer
Engineer
Posts: 4
Joined: 28 Mar 2016 02:21

Re: [Request] NML - Simple Tutorial for Changing Town Names

Post by DestroNK »

planetmaker wrote:However, while you're at it and as you now went through it: please feel invited to extend the documentation exactly there where you find it lacking. It's a volunteer project. Complaining that it should get better, without telling what is missing where while all info actually is there won't make it better - it needs you to amend it where *you* perceive it missing.
Hello, Planetmaker.

You got me absolutely wrong, I never wanted to complain about anything. I know that it is a volunteer project and I appreciate what the developers are doing here.
I just wanted to mention, that it is very hard - as not involved person - to just get anything together. So, to put a few questions together to a bundle, I'll just list
them:


1) Which lang file do I have to use for nml and where do I find it / where can I copy it from?
2) Is there anything important to know about that lang file, which I probably have to modify myself?
3) Considering my posted examples for the Town name Sources - what Entrys are required in the head of the Source Code?
4) What File Extension should I use to save my Source Code File? Is .nml correct?
5) How do I get the NML-tool to correctly render / compile my Source Code File?
6) "C:\Users\xxx\Documents\OpenTTD\newgrf" is the correct folder to save my .grf files, in ?

Thank you for your help,
Greetings DestroNK
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [Request] NML - Simple Tutorial for Changing Town Names

Post by Alberth »

1) Which lang file do I have to use for nml and where do I find it / where can I copy it from?
lang files connect symbolic names for strings to actual text. The github project you found should have one. The symbolic names are in the "grfid" block (please change the ID!)
2) Is there anything important to know about that lang file, which I probably have to modify myself?
You must supply text for all symbolic string names, must be saved in utf-8 format.
3) Considering my posted examples for the Town name Sources - what Entrys are required in the head of the Source Code?
Only the grfid block. If you want to have actual town names, a town name block is ueful too. The github project seems to have random prefixes and suffixes. This is not required, a simple list of names will do, as explained in the nml tutorial.
You can also have a look at town name projects in the devzone : http://dev.openttdcoop.org/projects
4) What File Extension should I use to save my Source Code File? Is .nml correct?
.nml is common, but not required.
5) How do I get the NML-tool to correctly render / compile my Source Code File?
"nmlc foo.nml" is probably sufficient, try "nmlc -h" otherwise for options help
6) "C:\Users\xxx\Documents\OpenTTD\newgrf" is the correct folder to save my .grf files, in ?
No idea, not a windows user. After activating the newgrf, don't forget to select the new town names in the game options
Being a retired OpenTTD developer does not mean I know what I am doing.
DestroNK
Engineer
Engineer
Posts: 4
Joined: 28 Mar 2016 02:21

Re: [Request] NML - Simple Tutorial for Changing Town Names

Post by DestroNK »

Hello, Alberth, thanks for your Reply.

After I took the Lang from the the Project (Github), the compiling worked and I can also find it ingame now :)

I didn't realize, that variables inside the GRF block of the .nml file get their content from the language file, lol :) A new thing I learned.

I'll try a bit around with the newly earned knowledge and try to figure something out -- and I'll reply here when I need furthermore help.

Thank you very much :)

Greetings, DestroNK
DestroNK
Engineer
Engineer
Posts: 4
Joined: 28 Mar 2016 02:21

Re: [Request] NML - Simple Tutorial for Changing Town Names

Post by DestroNK »

Ok, so here is already my first question - Compiling worked, the GRF does also show up in my Game, but As soon as I
try to change the Town Names List in the Game Settings, it does not show up.

Image
Image

Also tried it with the default github files, unchanged, they did also not show up. I also tried changing the ID, no change at all.
What am I doing wrong?

Greetings, DestroNK


Edit: aww Sorry >_< should probably open my Eyes. Never Mind.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Semrush [Bot] and 18 guests