Help with Industries' property 24

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

a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Help with Industries' property 24

Post by a.locritani »

I've read on wiki that this property is available since alpha 2.6 so i downloaded last nigtly to try a simple grf.
my aim is to assign the name of a nearby industry to a station (as roujin did with an ottd patch), so I wrote

Code: Select all

00 0A 01 01 02 24 "\80sawmill" 00
to assign the city name (\80) and "sawmill" to the station built near a sawmill. Or I've misunderstood the use of this property?
I'm not sure if I have to set property 08 (replace industry) but i think not.
anyway, it doesn't work.

Any idea? I've to set some patches in TTDpatch to get it works?

thanks
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

You can´t hack in the name directly. Industry prop24 requires a text-ID instead. Read http://wiki.ttdpatch.net/tiki-index.php ... Industries

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

pardon, i may be stupid, i read that article so many times and I never understand that i need a TextID :oops: and it's also clearly expressed :oops: :oops: :oops:
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

a.locritani wrote:pardon, i may be stupid, i read that article so many times and I never understand that i need a TextID :oops: and it's also clearly expressed :oops: :oops: :oops:
You might set up the required text(s) by using action4, e.g. like this

Code: Select all

-1 * 0     04 0A 81 01 00 DC "\80 Sawmill" 00
-1 * 0     04 0A 82 01 00 DC "\80 Sägewerk" 00
-1 * 0     04 0A 83 01 00 DC "\80 Scierie"  00
-1 * 0     04 0A 84 01 00 DC "\80 la Serrería" 00
and then place the reference (DC00) into prop24.

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

or i can refer to existing textID, i think
Last edited by a.locritani on 13 Nov 2008 12:14, edited 3 times in total.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

a.locritani wrote:or i can refer to existing textID, i think
Yes, o/c. But they don´t contain the placeholder for the town name.

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

So I think I can create an action 4 in this way:

Code: Select all

-1 * 0     04 0A FF 01 00 DC 80 81 04 48
where FF is the code for text retailed unchanged no matter what language is set
00 DC is my code to which i'll refer in property 24
80 is city name
and 81 04 48 prints the textID 4804 "sawmill"

I can't try, now, but should this work? I expect that 4804 is "sawmill" in english but if i using another language it will be translated automatically and so my 00 DC text will change but without changing its iD, but I'm not sure
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

Yes, that should work.

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

excuse me, but using

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 06 00 00 00
    1 * 21	08 07 "AL" 01 01 "test" 00 "long test" 00
    2 * 16	04 0A 81 01 00 DC 80 " Sawmill" 00
    3 * 17	04 0A 82 01 00 DC 80 " Sägewerk" 00
    4 * 16	04 0A 83 01 00 DC 80 " Scierie" 00
    5 * 20   04 0A 84 01 00 DC 80 " la Serrería" 00
    6 * 8	 00 0A 01 01 02 24 00 DC
still it doesn't work. any idea?
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

a.locritani wrote:still it doesn't work. any idea?
Add an industry prop 08?

I.e.,

Code: Select all

2 * 12     04 0A 81 01 00 DC 80 20 81 04 48 00
3 * 10     00 0A 02 01 00 08 02 24 00 DC

should work OK.

BTW "doesn't work" doesn´t say much more than nothing. 8)

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

ok, now it works almost every time. to better explain:
if I build a station over or near (i'm not sure) a tree the station is called "... woods". If i build near a slope the station is called "... valley". In these cases, the station is also near a sawmill. if the station is only near a sawmill but not in previous situation, then the station is called "... sawmill"

you are right, when i said "doesn't work" was not clear what problem I had: simply the station didn't apply wanted name, but now "it works".

thank you very much for all your patience, michael :bow:
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Help with Industries' property 24

Post by DaleStan »

a.locritani wrote:if I build a station over or near (i'm not sure) a tree the station is called "... woods". If i build near a slope the station is called "... valley". In these cases, the station is also near a sawmill. if the station is only near a sawmill but not in previous situation, then the station is called "... sawmill"
That is not the way it is supposed to work. Post a (TTDPatch, obviously[0]) savegame with the intended station build site marked in some obvious way (cleared or purchased land would be best), along with the GRF, your ttdpatch.cfg, and your newgrfw.cfg. If you've already built the station, destroy it and wait for the sign to disappear.

[0] Indu prop 24 does not work in OpenTTD.
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
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

ok, i'll post all requested data tomorow (saturday), because I'm still working on the grf to include all others industries in addition to sawmill (implemented with the help of Micheal). maybe when all industries' property 24 are implemented, the naming issue (...wood, ...valley) will disappear, but i think not.

regards
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

DaleStan wrote:
a.locritani wrote:if I build a station over or near (i'm not sure) a tree the station is called "... woods". If i build near a slope the station is called "... valley". In these cases, the station is also near a sawmill. if the station is only near a sawmill but not in previous situation, then the station is called "... sawmill"
That is not the way it is supposed to work. [...]
Here you go.

This is quite interesting. Stations are named correctly but not all the time. I´ve tried to figure out what the Wiki means with "near" but to no avail. And it´s not only with "woods" or "valley", but happens with other suffixes as well. See below.
prop24.png
prop24.png (22.36 KiB) Viewed 1863 times
Tested with TTDPatch Win r2045.

PS: no savegame needed, it´s quite obvious.

regards
Michael
Attachments
prop24.zip
(3.59 KiB) Downloaded 39 times
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

Michael, (another) quick question:
it's indifferent to set ID to 00, if using property 08? I don't understand...
You set ID to 00, and I set ID to "ID of current industry i'm modifing", in this case 02 but results are the same...

Code: Select all

your code:
            vv
00 0A 02 01 00 08 02 24 00 DC

my code:
            vv
00 0A 02 01 02 08 02 24 00 DC
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

a.locritani wrote:[...] I don't understand...
You set ID to 00, and I set ID to "ID of current industry i'm modifing", in this case 02 but results are the same...
The industrie´s ID is unimportant in this context, i.e. you can´t replace an industry in this way. Both ID=0 and ID=2 are generating new sawmill industries.

If you want to replace an industry by a new one you´ll have to remove it by setting it´s property 08 to "FF" first. And even then the new industry ID you´ll use would be still meaningless.

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

Why are we using property 08 and not property 09?
wiki wrote: By overriding an old type, you're saying "my type is a substitute for that old type"[...] For example, if you want to replace the old coal mine with something that changes its coal production more dynamically, use property 09 to override industry 00. This way, other industries that want to be far from coal mines will stay far from your industry type too. If, however, you want to replace the coal mine with a potash mine, do not use property 09. This will ensure that other industries don't consider your type as a coal mine.
I'm really trying to understand... :? using 09 I use my new defined industry as a replacement of the industry indicated by ID following 09 property (00 09 <id of replaced industry>) . If I use <Id of disabled industry> 08 FF i'm disabling that industry. is it right?
and if i use <no-matter-id> 08 <id>, in our case 00 08 02, i'm simply changing the property of industry indicated by id (in our case 02, sawmill)? or better, i'm creating a new industry copying the original one and i'm changing property on the copy? if it is the case, shouldn't i delete (<id> 08 FF) the copied one to avoid the reaching of 37-industry limit?

So in my case, using property 24 on all industries, shouldn't i use property 09 to override old industries?
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

a.locritani wrote:Why are we using property 08 and not property 09?
Ah yes, sorry. In fact, for a working replacement of the old sawmill (and not just for a quick test of prop24) we would need both prop08 and prop09. I.e.

Code: Select all

-1 * 12    00 0A 02 01 <ID> 08 02 09 02 24 00 DC
In this way you´re "creating a new industry copying the original" and overriding the original industry in one go.

However, you don´t need to set <ID> to the ID of the overridden industrie (sawmill = 02). The ID is irrelevant. O/c, you may do so ...

regards
Michael
Image
a.locritani
Engineer
Engineer
Posts: 111
Joined: 08 Feb 2007 11:59
Skype: a.locritani
Location: Italy

Re: Help with Industries' property 24

Post by a.locritani »

Once again, thanks Michael.

I want to let all know that using both property 09 and 08 the strange behavior of station not named correctly in some cases seems to be no long a problem.

but i noted something strange:
when i write in nfo

Code: Select all

00 0A 03 01 20 08 20 09 20 24 20 dc
and I encode the info and decode the resulting grf I obtain

Code: Select all

00 0A 03 01 20 08 20 09 " $ Ü"
both decoding using -x and without using -x

the same happens for every other code following (so, 21 24 21 dc, 22 24 22 dc, etc...): they all become strange strings.

is this a problem? and if it is, how can be solved?
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: Help with Industries' property 24

Post by michael blunck »

a.locritani wrote:[...] using both property 09 and 08 the strange behavior of station not named correctly in some cases seems to be no long a problem.
Not really. I´ve tested it as well.
when i write in nfo

Code: Select all

00 0A 03 01 20 08 20 09 20 24 20 dc
and I encode the info and decode the resulting grf I obtain

Code: Select all

00 0A 03 01 20 08 20 09 " $ Ü"
both decoding using -x and without using -x

the same happens for every other code following (so, 21 24 21 dc, 22 24 22 dc, etc...): they all become strange strings.

is this a problem? and if it is, how can be solved?
No. Just use

Code: Select all

grfcodec -d -t sawmill.grf
regards
Michael
Image
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Google [Bot] and 9 guests