Issue with unexpected tokens in nml code

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
The Polman
Engineer
Engineer
Posts: 6
Joined: 04 Jan 2018 09:32

Issue with unexpected tokens in nml code

Post by The Polman »

Since a few days, I've been working on a town name string including names of towns in all regions where Malay/Indonesian is spoken (Malaysia, Indonesia, Brunei). You'll see the first town names in a code here below. Up to so far, I read tutorials about the installation of NML and about how the code for a town name set is being made. However, I encounter a problem with unexpected tokens in the code you see below (further description of the problem below the code):

Code: Select all

grf {
	grfid:	"\50\4F\4C\00";
	name:	string(STR_GRF_NAME);
	desc:	string(STR_GRF_DESCRIPTION);
	version:	0;
	min_compatible_version:	0;
}

town_names(A) {
	styles:	string(STR_GAME_OPTIONS_TOWN_NAME_NUSANTARA);
	{
	text("Jakarta", 5),
	text("Kuala Lumpur", 5),
	text("Surabaya", 3),
	text("Medan", 1),
	text("Makassar", 1),
	text("Bandung", 1),
	text("Johor Bahru", 1),
	text("Kota Kinabalu", 1),

	}
}
From the line with "name" in it, I encountered the unexpected token error. I have tried to remove the error but once I fill in a random name it just continues to the line below. When I remove that line it continues to give errors on the next line, etcetera. Does someone know what is the problem here?

I have included the code in the same folder as nmlc and python (and some other files). There are a few lines of code before giving some descriptions like "//name". Though I haven't included a language code in the folder, giving the following warning:

Code: Select all

[K nmlc warning: Default language file "lang\english.lng" doesn't exist

Is this code required as well or is this just optional? What has to be included in this file and is there a good example of such a file?

Maybe this request may sound a bit silly, but I hope you can help me. Thanks in advance.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Issue with unexpected tokens in nml code

Post by Eddi »

your problem is the missing .lng file. it needs to contain the words for the strings needed for "name" and "description", you cannot just put strings inside the GRF itself.

english.lng:

Code: Select all

STR_GRF_NAME       :put name here
STR_GRF_DESCRIPTION:put dscription here
The Polman
Engineer
Engineer
Posts: 6
Joined: 04 Jan 2018 09:32

Re: Issue with unexpected tokens in nml code

Post by The Polman »

Thank you :D . If there are any new issues I'll stumble upon then I'll post these as well.
The Polman
Engineer
Engineer
Posts: 6
Joined: 04 Jan 2018 09:32

Re: Issue with unexpected tokens in nml code

Post by The Polman »

It worked as far as I created the .lng file, including language id (00), the name and description of the nml file plus the STR_OPTIONS_TOWN_NAME line. The grf was created successfully and pasted in between the other GRF's I downloaded. However, despite activating the grf, it does not appear in the options menu at town name strings (not even as an undefined string). What went wrong?

Update: problem solved, I got the names into the game :D
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests