Station ratings

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4754
Joined: 09 Sep 2007 05:03
Location: home

Re: Station ratings

Post by Alberth »

Ben1338 wrote:Well, that's interesting, I've been trying to compile the source as-is following https://www.tt-wiki.net/wiki/NMLTutoria ... sing_NML_3, Including "Klmnc ERROR: "ratings.nml", line13: Unknown string "STR_GRF_NAME"

I've tried to implement patches by substituting them with names, and they seem to work. But I wondered if it compiles okay for you?
Strings are defined in languages files, by default lang/english.lng file looking like (picked a random english sample file, so yours may look different):

Code: Select all

##grflangid en_GB
STR_NULL                       :
STR_REGRESSION_NAME            :NML regression test
etc. First line defines the language of the file, then each line "<string-name> :<string-text>". Note that every character behind the ":" is relevant, ie "STR_BLA : XY" means " XY" (with leading white-space) is the string text.

You can have several .lng files, for different languages. In this way you can have translations for your grf.
Being a retired OpenTTD developer does not mean I know what I am doing.

User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 165
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: Station ratings

Post by Ben1338 »

Of course : and ; are important characters when dealing with code.
But when I try to compile it using Kalen's nmlc ratings.nml command and https://www.tt-wiki.net/wiki/NMLTutorial/Installation it results it results in the image below:
Image
While the code is the following:

Code: Select all

11:grf {
12: grfid:	"\31\FF\0C\01";
13: name: string(STR_GRF_NAME);
14: desc: string(STR_GRF_DESC);
15: url: string(STR_GRF_URL);
16: version: 1;
17: min_compatible_version: 1;
18:
19: param {
10:  station_rating_algorithm {
21:   name: string(STR_PARAM_NAME_STAT_RATING);
22:   desc: string(STR_PARAM_DESC_STAT_RATING);
23:   def_value: 0;
24:   min_value: 0;
25:   max_value: 2;
26:   names: {
27:    0: string(STR_PARAM_VALUE_STAT_RATING_DEFAULT);
28:    1: string(STR_PARAM_VALUE_STAT_RATING_REDUCED_TIME);
29:    2: string(STR_PARAM_VALUE_STAT_RATING_100);
30:   };
31:  }
32: }
33:}
As for the .lng files, the tutorial never talked about that during the installation?

The problem seems to be something on my end since all of the lines seems to be related to the STR variables.

I literally installed it a few days ago and don't really know much about how it or the language works and given the fact that Kalen has manged to compile it seems to suggest that the nml compiler on my end isn't working correctly?

User avatar
Kalen
Traffic Manager
Traffic Manager
Posts: 160
Joined: 07 Jun 2008 22:07
Location: Portugal

Re: Station ratings

Post by Kalen »

When you extracted this NewGRF's source did you include its lang folder with the english.lng file in it, or did you just extract the ratings.nml file? I'm guessing that's the file the compiler isn't being able to find?

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4754
Joined: 09 Sep 2007 05:03
Location: home

Re: Station ratings

Post by Alberth »

Kalen wrote:When you extracted this NewGRF's source did you include its lang folder with the english.lng file in it, or did you just extract the ratings.nml file? I'm guessing that's the file the compiler isn't being able to find?
Exactly, in the directory where you run nmlc (ie in OpenTTD\Projects), there has to be a "lang" directory, and in it has to be an "english.lng" file.
In other words: "OpenTTD\Projects\lang\english.lng" must exist, and contain the string name and text for all the STR_* names in the ratings.nml file.
Being a retired OpenTTD developer does not mean I know what I am doing.

User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 165
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: Station ratings

Post by Ben1338 »

Ah, thanks for the help, it has exported properly.

User avatar
3iff
Tycoon
Tycoon
Posts: 1012
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Station ratings

Post by 3iff »

Glad it worked. I am careful when posting sources so that it should work instantly.

For info, I did exactly the same as you when trying a source from someone else. I omitted the /lang and lang file...and surprise, surprise, it didn't work. I know better now.

User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 165
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: Station ratings

Post by Ben1338 »

Hey

Could someone explain me the gist of callbacks and the Item() properties as there's so little information on those items on the Wiki?

Diesel Power
Traffic Manager
Traffic Manager
Posts: 202
Joined: 18 Jun 2016 19:05

Re: Station ratings

Post by Diesel Power »

I'm testing this with the new FIRS 4 (64 cargos) alfa and it seems to only work for the first 32 cargos (minus Pax and Mail). The other 32 behave as normal. Kinda expected this as it was coded before 64 cargoes was possible. Just wanted to bring it to your attention

User avatar
3iff
Tycoon
Tycoon
Posts: 1012
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Station ratings

Post by 3iff »

I'm not surprised. I haven't yet got to grips with 64 cargoes. No idea if it's an easy fix or something more involved.

I'll try and get the new programs and have a look. It might be 1 week or maybe a very long time!

Thanks for the heads-up.

User avatar
andythenorth
Tycoon
Tycoon
Posts: 5118
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Station ratings

Post by andythenorth »

64 cargos changes the format for the industry properties and the production cb.

On the one hand it's quite simple, and on the other, it's quite involved to change an existing grf :)

The nml docs are now all updated for 64 cargos:
https://newgrf-specs.tt-wiki.net/wiki/N ... properties
https://newgrf-specs.tt-wiki.net/wiki/NML:Produce

User avatar
3iff
Tycoon
Tycoon
Posts: 1012
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Station ratings

Post by 3iff »

I've modified the ratings grf to include 64 cargos. I don't have a way of testing it so I've no idea if it works. I'm sure someone can test it for me. It's in post 1.

It may be ok to use it in an existing game but it might cause problems - so beware.

Diesel Power
Traffic Manager
Traffic Manager
Posts: 202
Joined: 18 Jun 2016 19:05

Re: Station ratings

Post by Diesel Power »

I'm On it.
Maybe a while before i can reply. having phone issues!

Diesel Power
Traffic Manager
Traffic Manager
Posts: 202
Joined: 18 Jun 2016 19:05

Re: Station ratings

Post by Diesel Power »

There's still some work to be done... so far I've found that Zinc and Stainless Steel don't work in Steeltown.

Also I've noticed that occasionally the percentage of all industries in a small area will drop for a few months then slowly come back up. The code did this even when it was part of FIRS so you can blame Andy! not a big issue, just something I've noticed. I'll try to catch it in a save so you can take a look.
Attachments
Steel City Transport, 15th Nov 1955.png
(343.21 KiB) Not downloaded yet

User avatar
3iff
Tycoon
Tycoon
Posts: 1012
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Station ratings

Post by 3iff »

Thanks. I'll have a quick look. I doubt those problems are due to this grf...but...

Found a bug. The original code I used appears to set delivery costs of passengers and mail to almost zero! Probably not a good idea. Had I actually used the grf I might have spotted this earlier...but no-one else saw it either, so perhaps almost no-one uses this!

Anyway, upgraded versions are enclosed here. Ratings13 is for 32 cargo sets, ratings15 for 64 cargo sets. I also enclose the ratings15.nml. Using ratings15.grf with a 32 cargo set will show lots of unused/unallocated cargos. If you wish to recompile it for 32 cargos, just delete references to cargos 32-63.
ratings13.grf
(3.5 KiB) Downloaded 47 times
ratings15.grf
(6.04 KiB) Downloaded 51 times
ratings15.nml
(12.87 KiB) Downloaded 29 times

Diesel Power
Traffic Manager
Traffic Manager
Posts: 202
Joined: 18 Jun 2016 19:05

Re: Station ratings

Post by Diesel Power »

Thanks, I'll test and report back.

aizen
Engineer
Engineer
Posts: 1
Joined: 21 Feb 2020 22:49

Re: Station ratings

Post by aizen »

thanks, i'll report if find some issue

Diesel Power
Traffic Manager
Traffic Manager
Posts: 202
Joined: 18 Jun 2016 19:05

Re: Station ratings

Post by Diesel Power »

This GRF is causing the cargo payment rate of one cargo to drop to £0 and a load of (undefined string) to apppear. The station rating part of it works perfectly with 64 cargos. I'm using ratings 15, FIRS 4 alpha 1 and JGRpp 33.2.0
Attachments
The Mountain Movers, 11th May 2001.png
(321.39 KiB) Not downloaded yet

Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 7 guests