Various NML related questions

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

Moderator: Graphics Moderators

meslinjf
Engineer
Engineer
Posts: 20
Joined: 09 Jul 2015 17:32

Re: Various NML related questions

Post by meslinjf »

Transportman wrote: Which software versions did you install when following my guide? I do recall having had that error, and it was related to using the wrong Python version for the FindVersion script (which needs Python 2.7).
I'm using all the ones indicated, including Python 2.7
Sylf wrote:Something I didn't see in the guide after a quick skim: you need a c compiler to compile OpenGFX+ RV set. There's no C code, but it uses C preprocessor.
Interesting. Then which program should I use and how do I make it work with the compiling?
User avatar
TrainLover
Engineer
Engineer
Posts: 107
Joined: 01 Jul 2015 15:03

Re: Various NML related questions

Post by TrainLover »

Project North America.zip
(18.56 KiB) Downloaded 106 times
Can you read this nml file and see why the command line is saying, "ProjectNA.nml", line 20: Syntax Error, unexpected token"[".
Here is the whole file, and please read it for other things I should do, and for some criticism.
Developer of North American Passenger Liveries: viewtopic.php?f=26&t=87228
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Various NML related questions

Post by Alberth »

Code: Select all

spriteset(spriteset_EMD_Model_40, "gfx/EMD_Model_40_4-8.png")
    //left_X, upper_y, width, height, offset_x, offset_y {
        [ 0,       0,      8,    17,        3,        8]    <-- Line 20
        [ 16,      0,      20,   16,       -14,      -7]
        [ 48,     0,       28,    12,     -14,        -6]
    [ 96,     0,       20,    16,      -6,        -7]
    [ 128,    0,        8,    18,      -3,       -10]
    [ 144,    0,       20,    16,     -14,        -7]
    [ 176,    0,       28,    12,     -14,        -6]
    [ 224,    0,       20,    16,      -6,        -7]
}
Between the ")" at line 18, and the "[" at line 20 should be a "{".
There is one at line 19, but it's comment ("//" starts the comment, and everything after it is ignored by the NML compiler.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

I'm trying to force a particular cargo to be carried by box cars (trains) or a goods truck (road) only, but all my attempts at setting "cargo classes: bitmask" are getting me nowhere. Although for trains I do get a boxcar, I also get a flat wagon, and a similar thing for road vehicles. The cargo isn't suitable for wagons exposed to the elements.

Either what I'm doing is not possible or perhaps I just haven't hit the right combination. Any suggestions?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Various NML related questions

Post by planetmaker »

That's not how it works: It's not up to you (as industry set author) to decide how a cargo is transported. The vehicle sets decide it depending on the cargo label, and if no such special treatment present, by the cargo classes in which vehicles a cargo can be transported. Thus your label and the cargo classes convey suggestions which can be followed or not by a vehicle set.

As industry set author you can only set a sensible set of cargo classes and hope that the cargo is transported in an appropriate vehicle.
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: Various NML related questions

Post by Eddi »

you can try the "sheltered" class, but if the vehicle set doesn't comply with your wishes, there's nothing you can do.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

That's why I was getting nowhere. I had an idea that was how it works...ah well, I'll have to live with it for now.

Thanks again for a quick response.

"Sheltered" ? that's a new one to me...it's worth a try.

(I did try CC-COVERED without success, perhaps this is the same as sheltered?)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Various NML related questions

Post by planetmaker »

3iff wrote:That's why I was getting nowhere. I had an idea that was how it works...ah well, I'll have to live with it for now.

Thanks again for a quick response.

"Sheltered" ? that's a new one to me...it's worth a try.

(I did try CC-COVERED without success, perhaps this is the same as sheltered?)
That's the same.

http://newgrf-specs.tt-wiki.net/wiki/NM ... go_classes
http://newgrf-specs.tt-wiki.net/wiki/Ac ... s_.2816.29
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Various NML related questions

Post by TadeuszD »

3iff wrote:I'm trying to force a particular cargo to be carried by box cars (trains) or a goods truck (road) only
The best combination of cargo classes for such cargo is CC_PIECE_GOODS + CC_COVERED. You can check https://newgrf-specs.tt-wiki.net/wiki/CargoTypes what other industry sets do.
If train or truck set doesn't accept this cargo class combination, it is the problem with that set. You can report the bug to it. ;)
Image
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

Nice try but that gives no wagons/trucks at all. Tried on Iron Horse, OGFX+ trainset and eGrvts.

In Iron horse it will transport stuff in 'boxes' on flatcars so that's acceptable for now. I haven't had a look at how the other vehicle sets handle it.

Thanks anyway.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Various NML related questions

Post by TadeuszD »

Are you creating a new cargo, or you're redefining the existing one? The existing cargo can be included/excluded manually by the trainset author, regardless of the cargo classes.

BTW - could you test your cargo with PKP Set 2.0? Cargo defined as CC_PIECE_GOODS + CC_COVERED should be transported in box (covered) cars.
Image
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

I'm re-using an existing one (WOOL, but with names changed). I'll try the PKP set 2 and report back soon.

I get NO vehicles at all. I'm reusing WOOL from firs, cargo id 15. It must be me...I'm using

cargo_classes: bitmask(CC_PIECE_GOODS + CC_COVERED);

Don't worry about it, it's not on my list of priorities.

I just tried an earlier version of SPI and converted WOOL (which remains as it was from firs) and the above bitmask doesn't provide any vehicles either.
Last edited by 3iff on 16 Sep 2015 09:35, edited 1 time in total.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Various NML related questions

Post by planetmaker »

3iff wrote:I'm re-using an existing one (WOOL, but with names changed). I'll try the PKP set 2 and report back soon.

I get NO vehicles at all. I'm reusing WOOL from firs, cargo id 15. It must be me...I'm using

cargo_classes: bitmask(CC_PIECE_GOODS + CC_COVERED);

Don't worry about it, it's not on my list of priorities.
Uh... you want to correct your syntax, then it also might work (you want to supply a list instead of a sum to bitmask):

Code: Select all

cargo_classes: bitmaks(CC_PIECE_GOODS, CC_COVERED);
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

sigh, if someone says "CC_PIECE_GOODS + CC_COVERED" then that's what I believe I'm supposed to use.

I'll try again.

(I did have (CC_PIECE_GOODS, CC_COVERED) originally.)

Ok, that works fine in PKPv2. I get covered wagons only. So, perhaps it's an issue with other vehicle sets. I'll report it to them when I get a chance.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Various NML related questions

Post by planetmaker »

3iff wrote:sigh, if someone says "CC_PIECE_GOODS + CC_COVERED" then that's what I believe I'm supposed to use.

I'll try again.

(I did have (CC_PIECE_GOODS, CC_COVERED) originally.)

Ok, that works fine in PKPv2. I get covered wagons only. So, perhaps it's an issue with other vehicle sets. I'll report it to them when I get a chance.
Tadeusz didn't give any syntax. But that's why there is the documentation... http://newgrf-specs.tt-wiki.net/wiki/NM ... _functions .
It should always be correct on how syntax works.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

I generally follow the existing code and I'd never seen (x + y) in that place, always (x,y). However there's a lot of code I don't know and so assumed it was a different way of coding something.

...but I know now.

Thanks for your patience.
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: Various NML related questions

Post by Eddi »

always take random lines posted on the forum with a grain of salt, it may be syntactically or semantically incomplete, as it was probably sloppily written down. always try to understand what it's supposed to mean, and only then apply it.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

Well if it doesn't work it'll be removed. I test new changes (I'm making a lot) and using external sourced code will be thoroughly tested.

Actually (CC_PIECE_GOODS + CC_COVERED) compiles ok, it just doesn't work (and I've no idea what it might actually be trying to do).

Sometimes progress is slow. :?
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Various NML related questions

Post by Sylf »

3iff wrote:(CC_PIECE_GOODS + CC_COVERED) compiles ok
Yup, syntactically, it is a correct NML statement. Those cargo class constants are string representation of integers, so you can add them, and it'll produce a valid result.
bitmask() takes an arbitrary number of parameters.
bitmask (CC_PIECE_GOODS + CC_COVERED) means it adds CC_PIECE_GOODS and CC_COVERED, then apply the bitmask function - bitmask function in this case doesn't do anything.
bitmask (CC_PIECE_GOODS, CC_COVERED) takes two parameters separately, and apply the bitmask function. That's why this version works as intended (semantically correct) while the above line doesn't.
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: Various NML related questions

Post by Eddi »

3iff wrote:I've no idea what it might actually be trying to do
that's exactly what i meant. you should be trying to figure that out.
Sylf wrote:bitmask function in this case doesn't do anything.
that isn't true, bitmask(n) calculates 2^n.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 6 guests