Various NML related questions

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

Moderator: Graphics Moderators

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

Re: Various NML related questions

Post by 3iff »

3iff wrote:I've no idea what it might actually be trying to do
Eddi wrote:that's exactly what i meant. you should be trying to figure that out.
I do, but 'bits' are confusing and even other people have trouble understanding...

I have learned a lot recently though.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Various NML related questions

Post by PikkaBird »

TadeuszD wrote:
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.
Er, actually, if you want a goods-like cargo to be transported in goods-like vehicles, the best cargo class to use would be that used by goods: CC_EXPRESS.
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 thought that too and I think I tried it without success. So, I've tried 2 combinations with the following results.

CC_EXPRESS

PKP2 - Box and flatbed
Iron horse - mail, combine, open, box
OGFX - piece goods, flatcar

CC_EXPRESS, CC_COVERED

PKP2 - covered wagon
Iron horse - mail, combine, open, box
OGFX - piece goods, flatcar

so PKP 2 set seems to handle things fairly well but the other 2 sets I've tried appear to have more flexible conditions.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Various NML related questions

Post by PikkaBird »

3iff wrote:I thought that too and I think I tried it without success. So, I've tried 2 combinations with the following results.
Well, in that case, I'll repeat what planetmaker said earlier:
planetmaker wrote: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.
Most vehicle sets try to provide at least one wagon for every possible combination of cargo classes, so they will often be quite flexible. I imagine adding CC_EXPRESS to box wagons is more common than excluding CC_COVERED from flat wagons is. :)
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 »

PikkaBird wrote: Most vehicle sets try to provide at least one wagon for every possible combination of cargo classes, so they will often be quite flexible. I imagine adding CC_EXPRESS to box wagons is more common than excluding CC_COVERED from flat wagons is. :)
Especially as a container would count as 'covered', too. And it's a perfect cargo for flatbed wagons :)
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Various NML related questions

Post by TadeuszD »

PikkaBird wrote:I imagine adding CC_EXPRESS to box wagons is more common than excluding CC_COVERED from flat wagons is. :)
It depend on wagon type. ;)
For example in PKP Set v2 all covered (box), flatbed and container wagons can carry CC_EXPRESS and CC_PIECE_GOODS cargoes (except a few cargoes enumerated one by one). But ordinary flatbed wagon can not carry CC_COVERED cargoes because of its graphical representation. Cargo in ordinary flatbed wagon in PKP Set v2 is 'transported' using crates similar to wooden crates, which are not water- or humidityproof. However, CC_COVERED can be transported in containers on special container wagon, because of containers are waterproof. But container wagon can not carry CC_OVERSIZED cargoes, because the cargo should be put inside the container - its size is limited.
Of course, covered wagons can carry CC_COVERED cargoes, but they can not carry CC_OVERSIZED cargoes because of limited size of doors.
I hope it is easy to imagine. :)
Image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Various NML related questions

Post by Alberth »

Of course, covered wagons can carry CC_COVERED cargoes, but they can not carry CC_OVERSIZED cargoes because of limited size of doors.
Sure they can, just put the doors at one end, and drive the cargo out, knight-rider or james-bond style :D
Being a retired OpenTTD developer does not mean I know what I am doing.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Various NML related questions

Post by Wahazar »

What about hypothetical cargo with both covered and oversized flag turned on?
Maybe sliding sides wagon should be considered?
http://kolej.krb.com.pl/oznaczenia/sis_bok.gif
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Various NML related questions

Post by TadeuszD »

Alberth wrote:Sure they can, just put the doors at one end...
You right. Similar wagons exist. Please look up in the Google at German 'Bromberg' wagon for example:
https://c2.staticflickr.com/6/5131/5526 ... 8d16_b.jpg
But there is no such wagons in PKp Set v2.
What about hypothetical cargo with both covered and oversized flag turned on?
Could you show examples from real world?
Image
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5649
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Various NML related questions

Post by andythenorth »

3iff wrote:I'm trying to force a particular cargo to be carried by box cars (trains) or a goods truck (road) only
I know planetmaker already said this, and I know it's not the answer you want, but...don't try to do that. It's not how it works :)

I have spent time chasing my tail, changing cargo classes in FIRS and testing with different sets to try and impose 'my' choice of vehicles. Nah, don't repeat my mistake. Choice of vehicle is with the vehicle newgrf, not the industry set :)

Join #openttd irc btw if you want more help. ;)
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

andythenorth wrote:I know planetmaker already said this, and I know it's not the answer you want, but...don't try to do that. It's not how it works
I now know. I have that comment in my changelist..."it don't work like that", but in uppercase.
I did think I might be able to control it but no I can't, so I'm not worried.

A lot of this is because I have an idea of something I might be able to do. If I can't get it to work then maybe it's because I'm doing it wrong (mainly due to not knowing everything about ottd code) or it's simply not how the game works.
User avatar
colossal404
Chief Executive
Chief Executive
Posts: 652
Joined: 07 Mar 2009 12:48
Location: Szeged, Hungary

Re: Various NML related questions

Post by colossal404 »

At work I have a lot of thime to think, and I'd like to ask, is placing sub-categories in refitting possible, is it worth overthinking or it is already a dead idea? I would like to complicate my set give the player some choice of what he/she want to see on the road, and this would be the best way to do it I think... (unless, there would be a very long purchase list if I have to separate everything but the cargo and it's graphic appearance)
Attachments
I made some "art"work, not balanced, not actual font type, I just reinvented some letters...
I made some "art"work, not balanced, not actual font type, I just reinvented some letters...
subsubsub.PNG (6.61 KiB) Viewed 6682 times
Image
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Various NML related questions

Post by Transportman »

No, you cannot, you can have different subtypes for different cargoes and use that to create liveries for different cargoes, but in the way you pictured it it is not possible.

I would advise to use different vehicles as they really seem to be different.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

Back on page 2 of this thread I was trying to display a custom message. I'm now trying to do the same thing but with a variable number included.

switch(...
// (there's a variable number here I wish to print in the STR_INDUSTRY_TEXT text)
// I've tried (STORE_TEMP(LOAD_TEMP(7),257)),
// I've also tried (STORE_TEMP(LOAD_TEMP(7),258)),
...
return [STORE_TEMP(string(STR_INDUSTRY_TEXT), 0x100), CB_RESULT_IND_PROD_NO_CHANGE | 1 << 8];

and in the lang file...

STR_INDUSTRY_TEXT :Text {COMMA} text

So, I'm getting the text displaying fine but the number (as in {COMMA}) is completely wrong, usually zero or around 85 instead of 12 or so. It seems I'm trying to pass the value wrongly, or {COMMA} is the wrong way to read it, or it can't be done. It does show a number, just not the one I want so I guess it can be done, if only I can pass the number correctly.

Any ideas?

---

Actually, looking through the NML wiki, it might be that I can't pass a value to the message.
Is there any way I can create a news message with an associated value?
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Various NML related questions

Post by frosch »

The production change and closing news messages do not support any custom parameters.
The strings can only contain exactly one {STRING}, which will print the name of industry itself.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

Thanks. I guessed this was the case after wading through the nmlwiki. It would have been nice to do but it's absolutely not a problem.
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 currently messing about with an aircraft grf. I've scoured the nmlwiki without success.

I want a plane to be a freight plane, carrying (for now) goods, supplies, food or fruit. I've managed to limit the refit process to these cargos but I have two annoying problems.

1. I want the default cargo to be goods but I can't find a method for setting this. For road vehicles I can use 'default_cargo_type: (cargo id);' but this isn't permitted for aircraft. Currently I have a default of fruit.

2. The specified cargo size is halved for goods (40 cargo = 20 goods) but quartered for other cargos. It's implied that this can be overridden but I can't see anything obvious.

Any pointers would be gratefully received. Thanks.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Various NML related questions

Post by frosch »

Aircraft will always default to the first refittable cargo. "first" as in first in your "cargotable".
You can reorder your cargotable, but it will affect all aircraft.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: Various NML related questions

Post by 3iff »

Thanks. I'll try that. It shouldn't cause me any issues. FRUT is earlier in the cargo table than GOOD.

My planes (basically a modified default set) carry pass/mail except for some I've designated as cargo planes. Switching cargo order should be fairly transparent.

Is there any way around the goods = 2 cargo, other = 4 cargo ??

------------

Yep, that fixes the default cargo problem. Goods are now the cargo of choice when buying the planes. I wish I had known it was that easy.
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, I've managed to fix the goods/other cargo issue. I think I did exactly the same as I had tried yesterday...then it didn't work, today it does. If anyone is remotely interested, I'll post the 'fix' here. Basically I had a look at (and copied) some of the WAS (world airline set) code and it worked.

However, I now have a problem with helicopters. If I do the same fix as above they lose their ability to carry pass and mail at the same time. So, I was considering splitting the job into two. The base helicopter (Tricaro) would be normal and there would be a duplicate (Tricaro Cargo) to handle the cargo duties.

The default helicopter uses:

item(FEAT_AIRCRAFT, Tricaro_Helicopter, 38) {
etc...

as its normal ID is 38, and that enables it to pick up the default sprites. But the duplicate helicopter can't do the same. It needs a new vehicle ID which is easy BUT I don't know how to make it pick up the same sprite graphics as I can't work out what NML code to use. I can find out which is the first sprite (I have the sprite image to hand) but can I just specify the first sprite number, or all 8.

I'm looking at the base_graphics command but I can't figure out how to code it up, assing that's the right one.

I tend to stay away from graphics if I can. I suppose I could extract the relevant sprites but then I have to specify the co-ordinates and XY offsets (and they were a nightmare for the few road vehicles I did).
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests