NewGRF: Temperate Oil Wells don't only_decrease

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

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Current version of the Grf:
oilsgoup.grf
(196 Bytes) Downloaded 2180 times
Current version of the Grf's Source:
oilsgoup_v2.nfo
(1.08 KiB) Downloaded 829 times
Changes since the last version:
SirkoZ wrote:I only changed so it says "Temperate Oil Wells only_decrease neutraliser" instead of just "Only_decrease neutraliser" in the NewGRF selection window
[Old Post]
Greets all!

EDIT: The files (v2) can be found here.

This is my first NFO/newGRF and I have some problems with it:

1st line - Action 8 (which NFO renum comments and replaces with a random action 0 and then complains '8' isn't the first :-X):

Code: Select all

0 * 43 08 06 53 5A 13 44 20 4F 6E 6C 79 5F 64 65 63 72 65 61 73 65 20 6E 65 75 74 72 61 6C 69 73 65 72 20 42 79 20 53 69 72 6B 6F 5A 00
2nd line - Action 0 (which should say that only_decrease flag (80) for (Temperate) Oil Wells is null and void):

Code: Select all

1 * 10 00 0A 01 01 0B 1A 07 00 00 00
3rd line - Action 7 which should disable this newGRF if Temperate terrain isn't used (yet grf coded says Sprite 2's transparency and redundancy is 100% - I suppose this is bad):

Code: Select all

2 * 06 07 83 01 03 00 00
Please help me make this one work for as it would sometimes be fun to have abundant Oil Wells in temperate games.

Thx

SirkoZ
Last edited by Lakie on 31 Jul 2008 18:17, edited 6 times in total.
Reason: Please don't use bright colours that clash with the default tt theme, and added his newest grf version and source as requested.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by DaleStan »

Sprite 0 is not an action. NFORenum can't make sense of that sprite 0, so it comments it out and puts a valid one in. When it can make sense of the sprite 0, it removes it instead.

Generally, you want your action 7s to skip something. What is that one skipping?

As a general rule, the transparency/redundancy message is only interesting for real sprites. Pseudos always compress to exactly 100% of their original size. Also, that's a running total, not a per-sprite total.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Action 7 here should skip this whole grf if terrain set to 00 = temperate. Although with even Action 0 not working (neither in oTTD nor in TTDPatch) I want to fix that one first...any help?
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

None of you newGRF guru's (Purno et al) wrote any replies here - what gives?

Is this simple idea really so hard to implement - I mean one should be able to disable only_decrease flags with action 0, no?

I'm confused... :?
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Lakie »

What DaleStan tried to tell you is that the first sprite "0" must be the number of sprites in the file, the action / realsprites must begin from sprite "1" onwards.
Example for if you don't understand what you've been told:

Code: Select all

0 *  4        03 00 00 00
1 *  6        07 83 01 03 00 00
2 * 43        08 06 53 5A 13 44 20 4F 6E 6C 79 5F 64 65 63 72 65 61 73 65 20 6E 65 75 74 72 61 6C 69 73 65 72 20 42 79 20 53 69 72 6B 6F 5A 00
3 * 10        00 0A 01 01 0B 1A 07 00 00 00
Though I'm not sure if you are meant to skip the action8 to disable the grf these days.

Hope that helps,
~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by mart3p »

Well, I haven't done any industry coding myself, but I'll try and give you what help I can.

Firstly, people are more likely to respond, if you layout and document your nfo so it can be immediately understood. ;) Something like this:

Code: Select all

1 * 10 00 0A // Action 0 - industries
       01 01 // 1 property, 1 industry
       0B    // Id - oil wells
       1A    // Property - special flags
       07 00 00 00 // Value
I can now see you are setting property 1A to a value of 7. This is setting bits 0, 1 and 2, according to the wiki these bits are:
  • 0 - Industry plants fields
    1 - Industry cuts trees
    2 - Industry is built on water
I don't think that's quite what you intended... ;)
Image
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Lakie »

Indeed, I don't know anything about industries but based of the Wiki it looks although you mistook the bit for being the value you write into the nfo, you actually write the value of the bit (0x80 for bit 7).
Which would give you the desired effect (bit 7 - The industry cannot increase its production on the temperate climate (oil wells)).

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Thanks, Lakie and mart3p - I should have posted the corrected NFO, sorry. :oops:
I mean I understand what DaleStan was saying about the action 8 and that 0 * 4 00 00 00 00 - that's simple. :-)

What baffles me is:
1.)Why action 0 doesn't work - I mean the bit 7 that has value 80 is for only_decrease, but I wanted to disable the only_decrease behaviour, that's why I set all the values for bit 7 to 00.
I just don't know how would I disable it otherwise...

2.) Action 7 - I'll deal with it when I have the 0 sorted. However - I don't know how exactly I'd prevent this grf from loading in other terrains (not temperate). I set the comparison that if it's 00 (temperate terrain that it skips the grf or so I think)... :-)
Attachments
oilsgoup.nfo
my non-working nfo so far...
(363 Bytes) Downloaded 375 times
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Purno »

SirkoZ wrote:None of you newGRF guru's (Purno et al) wrote any replies here - what gives?
I don't code NFO, and since your question seems to be related to NFO, I cannot post anything useful to help you.
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Lakie »

As I said in my later post the value should be 0x80 not 0x07 (which is the bit number).

Code: Select all

    2 * 10	 00 0A 01 01 0B // Oil wells, one property
	 		      1A 80 00 00 00 // Can only decrease in production
As previously said by me, put the action7 above the action8.

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Purno wrote:
SirkoZ wrote:None of you newGRF guru's (Purno et al) wrote any replies here - what gives?
I don't code NFO, and since your question seems to be related to NFO, I cannot post anything useful to help you.
Oh. :oops:

Thanks anyway. ;-)
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Purno »

You're welcome :)
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Lakie wrote:As I said in my later post the value should be 0x80 not 0x07 (which is the bit number).

Code: Select all

    2 * 10	 00 0A 01 01 0B // Oil wells, one property
	 		      1A 80 00 00 00 // Can only decrease in production
As previously said by me, put the action7 above the action8.

~ Lakie
Beautiful. Thank you - this newGRF is now disabled in all non-temperate terrains. :D

Now - the action 0 - how would I neutralise that only_decrease flag that is present in the game alone for temperate oil wells? I want them to increase production too - that's the thing that I don't know. :(
Attachments
oilsgoup.nfo
Action 7 working well, action 0 even with 1A 00 00 00 00 still not...
(419 Bytes) Downloaded 338 times
Last edited by SirkoZ on 28 Jul 2008 13:12, edited 1 time in total.
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Lakie »

I'd imagine just making the value for Action0 Property 1A 0x00000000 would work in that case?

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Oh - thx - I'll try it out. :-)

EDIT: No...doesn't work. Oil wells still only_decrease (both OTTD and TTDP)...->nfo in the upper post - I edited it.
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by mart3p »

I think you need a little more than setting property 1A. If I start a game in OpenTTD with your grf and debug grf enabled, I get the following message.

Code: Select all

dbg: [grf] [Test\oilsgoup.grf:2] IndustriesChangeInfo: newid 11
dbg: [grf] [Test\oilsgoup.grf:2] IndustriesChangeInfo: Attempt to modify undefined industry 11. Ignoring.
It seems a property 08 must be set to define the industry, or all other property settings for that ID are ignored. The trouble then, is that property 08 creates a new additional industry type, based on the old one. I think you also need to use property 09 to override the original oil wells.

Code: Select all

2 * 14	 00 0A // Action 0 - industries
       03 01 // 3 properties, 1 industry
       0B    // Id - oil wells
       08 0B // Property - substitute industry type
       09 0B // Property - industry type override
       1A    // Property - special flags
       00 00 00 00 // Value - clear all bits
I can't promise that this is entirely correct, as I say, I have never done any industry coding, but it seems to work. :)
Attachments
oil production.png
oil production.png (56.27 KiB) Viewed 22424 times
Image
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Wow - that's great, mart3p - I also asked belugas and he said that by nullifying the 1A prop in OTTD we also loose the behaviours:
INDUSTRYBEH_DONT_INCR_PROD and
INDUSTRYBEH_BEFORE_1950
although with Oil Wells recreated as a new type it shouldn't be a problem. I don't know.

Those 08 and 09 props' usages sure look easy now. :-)

Thank you. ;-)

P.S.: I PMed belugas with this development - we'll see - I have the feeling it will be fine.
Thanks again, mart3p I really appreciate it.
I'll make the newGRF right away and post it here and also in my signature (link to it).

Works in OpenTTD (default and smooth_economy) and in TTDPatch (default_economy).

EDIT: The files (v2) can be found here.
Last edited by SirkoZ on 28 Jul 2008 17:51, edited 2 times in total.
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by Lakie »

Then add 0x100 to the value of bit 8 to 1A (remember that its little endian so the actual value would be "1A 00 01 00 00" in nfo).

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by SirkoZ »

Oh of course - it's that simple. I'm not used to all these bits so I was confused.

Thank you very much. ;-)

Version 2 - with disabled only_decrease and Oil Wells still being constructed before 1950:
Note: this newGRF is only intended to be used with the default TTD(Patch)/OpenTTD industries and not with any custom made (newGRF) industry sets.
Attachments
oilsgoup_v2.nfo
source - nfo v2
(1.02 KiB) Downloaded 496 times
oilsgoup.grf
newGRF (v2)
(176 Bytes) Downloaded 913 times
Last edited by SirkoZ on 28 Jul 2008 23:58, edited 1 time in total.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: NewGRF: Temperate Oil Wells don't only_decrease

Post by michael blunck »

Sorry to spoil the party, but I don´t see much sense in littering the world with lots and lots of tiny .grfs which make behaviour of "large" sets unpredictable. People will for sure collect every .grf encountered on the net and then complain about problems.

Be assured that this is a real problem. I.e., after succeeding in coding your first .grf why don´t you leave it for personal usage?

regards
Michael
Image
Locked

Return to “Graphics Development”

Who is online

Users browsing this forum: Semrush [Bot] and 13 guests