Nickel_Plate NML Questions

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

Moderator: Graphics Moderators

Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Nickel_Plate NML Questions

Post by Nickel_Plate »

After sorting about the lang files have done my first grf in NML.

This grf writing my multiplier so i can get a comparison.

The grf listed below was OK until i added the parameter in the grf block.

1. I now am getting a load of question marks appearing see screenshot.

2. In lang file what does 0x represent, 01 must mean english.

*****************************************************************
grf {
grfid: "NP\01\01";
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESCRIPTION);
version: 1;
min_compatible_version: 1;
/*****************************
Set parameter for multiplier
*****************************/
param(0) {
multiply_freight {
type: int;
name: string(STR_FREIGHT_MULTIPLY);
desc: string(STR_FREIGHT_MULTIPLY_DESC);
min_value: 1;
max_value: 3;
def_value: 1;
}
}
}
/******************************/
item (FEAT_TRAINS, Lev1, 84) {
property {
sprite_id: SPRITE_ID_NEW_TRAIN;
introduction_date: date(1920,01,01);
vehicle_life: 6;
model_life: 12;
speed: 97 km/h;
power: 1000;
weight: 160;
cost_factor: 20;
}
}
*********************************************************************
##grflangid 0x01
STR_GRF_NAME: Maglev1920
STR_GRF_DESCRIPTION: Allows Maglevs to start in 1920
STR_FREIGHT_MULTIPLY: Freight Multiplier
STR_FREIGHT_MULTIPLY_DESC: Multiply Freight Wagons but not Mail & Passengers

Screenshot with Question Marks
Screenshot with Question Marks
screenshot.png (41.28 KiB) Viewed 1123 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Nickel_Plate NML Questions

Post by planetmaker »

Nickel_Plate wrote: 1. I now am getting a load of question marks appearing see screenshot.

2. In lang file what does 0x represent, 01 must mean english.
ad 1) The lang file needs to be utf-8 encoded. Are you sure that that is the case. Also: You want the strings to start _immediately_ after the colon. Or do you intend them to start with a white space?

ad 2) the langID is in hexadecimal representation. Hexadecimal numbers are distinguished from decimal by a leading 0x
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

It was not white space but tabs can see the tabs were converted into question marks,
just checked swedish rails lang to see how that was written.

Thanks for your quick response.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

The 01 is indeed for English, see a full list of supported languages here.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

Try to refit Goods Wagon for paper, using paper.grf in temp climate.
This is the code below. Keep getting Unrecognized identifier 'PAPR' when
trying to compile.

item (FEAT_TRAINS, Goods, 94) {
property {
sprite_id: SPRITE_ID_NEW_TRAIN;
introduction_date: date(1920,01,01);
vehicle_life: 15;
model_life: 30;
cargo_capacity: 30;
weight: 18;
cost_factor: 190; //Purchase Price =$2226
refit_cost: 00;
refittable_cargo_classes: bitmask(CC_PIECE_GOODS);
refittable_cargo_types: bitmask(PAPR);
}
}
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

You have to include a cargotable in your nml file. You could copy lines 7..23 from this file in OpenGFX+ Trains.

Next time you post some code, could you please surround it by [ code ] and [ / code ] (without the spaces). Thanks.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

Thanks for reply will remember about

Code: Select all

 next time.

Having put cargotable in nml file when i try to compile am getting error

[b]'Parameters of bitmask cannot be greater then 31'[/b]

Does this mean i need to remove some of the cargos from table.
Last edited by Nickel_Plate on 25 Mar 2011 14:27, edited 1 time in total.
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Nickel_Plate NML Questions

Post by Eddi »

only the first 32 entries of a cargo translation table may appear in the refit mask.

PS: it should be "greater than". either you quoted it wrong, or it's a bug in nml.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

Nickel_Plate: it just means you'll have to shift the items around a little bit. PAPR should be one of the first 32 items in the list.

In nml r1305 there is no such typo :P

Edit: only now I'm reading the your code properly. Paper is in the cargo class "piece goods". As such you don't need to set refittable_cargo_types at all. In fact any cargo you set in refittable_cargo_types will switch cargos already set by refittable_cargo_classes. So because paper is enable by refittable_cargo_classes, it'll be disabled again by setting it also in refittable_cargo_types. See also http://hg.openttdcoop.org/nml/raw-file/ ... s-property
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

Have put PAPR at #27, but cannot get Paper to show up for Goods wagon.

This worked using normal nfo coding.

It says paper is piece goods in tables.
Steel, Livestock and Wood don't show up unless i remove one from bitmask.

Code: Select all

refit_cost:00;
refittable_cargo_classes:bitmask(CC_EXPRESS, CC_PIECE_GOODS);
refittable_cargo_types:bitmask(STEL, LVST, WOOD);
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

Nickel_Plate wrote:Have put PAPR at #27, but cannot get Paper to show up for Goods wagon.
Just checking to be sure: you do have another grf in your game that enables paper in temperate? It won't show up unless it's a valid cargo, which by default it is not in the temperate climate.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

Yes, been using it for a while, playing chill's patchpack with it installed.

Learning nml coding using my grf files have made as a check.

Downloaded from this forum somewhere.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

You must be doing something else wrong as the snippet you've shown before works fine and makes the goods van refittable to paper. Mind that you're changing only the maglev goods van when you edit id 94.

If you still can't get it to work start by posting a complete list of NewGRFs you use in your game. A savegame loadable with trunk would be preferred. Also post the complete nml file as attachment.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

Copy of NML file
Attachments
Maglev1920.nml
(4.62 KiB) Downloaded 106 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

Yexo wrote:start by posting a complete list of NewGRFs you use in your game
You write this a lot of times but never provide new graphics, just leave it out:

Code: Select all

sprite_id:					SPRITE_ID_NEW_TRAIN;
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

List of all NewGrf being used
  • [preset-Canyon2]
    landscape.grf =
    grassyknoll.grf =
    newterrainw_fixed_v2.grf =
    infra_landscapew.grf =
    sacsobjects1w.grf =
    TTD_landscapew.grf =
    infrstructure.grf =
    Infrastructure.grf =
    BKTunw.grf =
    combined_american_signal_set.1.1\ussigzw.grf =
    total_bridge_renewal_set.1.12\total_bridges.grf =
    total_town_replacement_set-3.11\ttrs3w.grf = 0 0 0 1
    newindustries.grf =
    steelm.grf =
    paperw.grf =
    stations.grf =
    platformsw.GRF =
    jstatsw.grf =
    ae_ruraw.GRF =
    ae_subuw.GRF =
    modernsuburbanw.GRF =
    newstatsw.grf =
    canstnw.grf =
    japanese_stations-2.0a\jpstationsw.grf =
    brickfreightw.GRF =
    indstatrw_08.grf =
    mlss027.grf =
    dwestationtiles__fences-v1.2\fences.grf =
    dwestationtiles_industrial_ter-v0.6\dwe_stat_r.grf =
    vehicles.grf =
    grvts.grf =
    heqs-0.7.1\heqs.grf =
    manual_industries-2r5\manindu.grf = 0 1 1 0 0 0 1 1 15
    Maglav1920T.grf = 3
    Maglav1928T.grf =
    Maglav1940T.grf =
    Maglav1950T.grf =
    Maglav1960T.grf =
    basemod-3.2\basecosts.grf = 1 10 8 9 44 6 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

Which of those would introduce the paper cargo? I'd really help if you could provide a link to the download location of that newgrf.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

The grf is one Patchman made, can find plenty of talk about it but cannot find link.

Can send copy.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Nickel_Plate NML Questions

Post by Yexo »

Sure, that's fine.
Nickel_Plate
Traffic Manager
Traffic Manager
Posts: 146
Joined: 27 Dec 2004 19:37
Location: Home of the Big Cat

Re: Nickel_Plate NML Questions

Post by Nickel_Plate »

Paper Grf
paperw.grf
(353 Bytes) Downloaded 128 times
Checked using OpenTTD 1.0.3.

Working using grf made with nfo. ( GrfCodec )

Not Working using grf made with nml.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 12 guests