Town names NML question(s)...
Moderator: Graphics Moderators
Town names NML question(s)...
Is it possible to have an if/else or something block to check random generated town names?
Something like this:
If the townname part 2 ends with 'SS'
and the townname part 3 starts with 'S'
then remove one 'S' so we dont get names with 'SSS' in them?
Something like this:
If the townname part 2 ends with 'SS'
and the townname part 3 starts with 'S'
then remove one 'S' so we dont get names with 'SSS' in them?
..: Trond :.. because you deserve it! 
The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell
MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell
MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
Re: Town names NML question(s)...
no. but you can work around that by separating the sets of prefixes that end with 's' from the ones that end differently, and provide different sets of suffixes for each set of prefixes
Re: Town names NML question(s)...
Thanks for the answer Eddi!
Thats what I was thinking about doing if there wasnt a way to achieve it with if/then... So I guess its back to work(around) then
One more question: the probabilities... never mind, I cant even formulate the question so that I understand it myself :/
Thats what I was thinking about doing if there wasnt a way to achieve it with if/then... So I guess its back to work(around) then

One more question: the probabilities... never mind, I cant even formulate the question so that I understand it myself :/
..: Trond :.. because you deserve it! 
The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell
MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell
MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Town names NML question(s)...
No, not directly. You need to tailor the composition rules such that it doesn't happen.Trond wrote:Is it possible to have an if/else or something block to check random generated town names?
Something like this:
If the townname part 2 ends with 'SS'
and the townname part 3 starts with 'S'
then remove one 'S' so we dont get names with 'SSS' in them?
EDIT: yes, and Eddi was much faster
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Town names NML question(s)...
I'm just starting with NewGRFs, and thought that it would be nice to create my own Town name generator. I have read most of the documentation on the wiki, and have created a project directory called "My_Norwegian_TownNames" with the following contents:
When I try to run grfcodec, this is what I get:
Here is the start of my .nfo file. I've tried to follow the "Town Names" example of the wiki:
What am I missing?
Code: Select all
leif@balapapa ~/projects/openttd/My_Norwegian_TownNames $ tree
.
├── custom_tags.txt
├── lang
│ └── english.lng
└── sprites
└── My_Norwegian_TownNames.nfo
2 directories, 3 files
Code: Select all
leif@balapapa ~/projects/openttd/My_Norwegian_TownNames $ grfcodec -e My_Norwegian_TownNames.grf
Encoding in temporary file My_Norwegian_TownNames.new
NFO file missing header lines and version info
Code: Select all
//
// Alternate Norwegian Town Names for OpenTTD
// Leifbk 2014
// Version 1, 2014-06-12
//
grf {
grfid: "LK\01\01";
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESCRIPTION);
version: 1;
min_compatible_version: 1;
}
town_names(one) {
{
text("Alme", 1),
text("Alve", 1),
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Town names NML question(s)...
You are coding in NML, not in NFO. You need the purl=http://bundles.openttdcoop.org/nml/]nmlc[/url] program to compile them.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Town names NML question(s)...
Great! I had nmlc installed already on my Gentoo Linux system. After a quick bug squash (a semicolon in an inappropriate place), I was able to successfully compile the .nfo. I've put the .grf file in the .openttd/content_download/newgrf folder, activated it in the NewGRF Settings, and started a new game, but my names don't show up. Is there a way to disable the original town names?Transportman wrote:You are coding in NML, not in NFO. You need the nmlc program to compile them.
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: Town names NML question(s)...
To activate a Town name NewGRF, you also have to set the town names in the Game Options window to use your town names.leifbk wrote:Great! I had nmlc installed already on my Gentoo Linux system. After a quick bug squash (a semicolon in an inappropriate place), I was able to successfully compile the .nfo. I've put the .grf file in the .openttd/content_download/newgrf folder, activated it in the NewGRF Settings, and started a new game, but my names don't show up. Is there a way to disable the original town names?Transportman wrote:You are coding in NML, not in NFO. You need the nmlc program to compile them.
Another small remark, if you download/compile a NewGRF, you should place it in your .openttd/newgrf folder, not in the content_download folder.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Town names NML question(s)...
Right, I understand what you mean. But when I look at that list, I can't find it. How do I set the label?Transportman wrote:To activate a Town name NewGRF, you also have to set the town names in the Game Options window to use your town names.
Thanks for the hint. I've done that now.Transportman wrote:Another small remark, if you download/compile a NewGRF, you should place it in your .openttd/newgrf folder, not in the content_download folder.
Re: Town names NML question(s)...
I found it myself - I had to provide the "styles : string(STR_STYLES);" with a meaningful text. And now I'm in a game with my very own town names, which feels good. The list needs a little tweaking thoughleifbk wrote:Right, I understand what you mean. But when I look at that list, I can't find it. How do I set the label?Transportman wrote:To activate a Town name NewGRF, you also have to set the town names in the Game Options window to use your town names.

A lot of thanks for your quick and very helpful hints

Edit: In case anybody finds this topic, the following may be helpful:
Code: Select all
$ nmlc --grf=mytownnames.grf sprites/My_Norwegian_TownNames.nml
$ cp mytownnames.grf ~/.openttd/newgrf/
Who is online
Users browsing this forum: No registered users and 7 guests