Coding aRVs with different capacity for each part

Get help, info, news and advice about the Transport Tycoon Deluxe patch.

Moderator: TTDPatch Moderators

User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

I wanted to code articulated RV with different capacities for each part. I used this code:

Code: Select all

   72 * 9	  02 01 10 01 01 00 00 00 00
   73 * 9	  02 01 11 01 01 01 00 01 00
   74 * 9	  02 01 12 01 01 02 00 02 00
   75 * 9	  02 01 13 01 01 03 00 03 00
   76 * 22	 02 01 20 82 46 08 03 03 10 00 00 00 11 00 01 01 12 00 02 02 13 00
   77 * 9	  02 01 21 01 01 04 00 04 00

   78 * 14	 02 01 25 81 10 00 FF 01 00 FF 0F 0F 20 00 //change capacity to 0
   79 * 14	 02 01 27 81 0C 00 FF 01 25 00 36 36 20 00 //apply that capacity via Callback 36

   80 * 14	 02 01 30 81 41 00 01 01 27 00 00 00 21 00 //when consist is formed, use c-ID with new capacity
   81 * 14	 02 01 31 81 10 00 FF 01 46 FF 01 01 FF FF
   82 * 18	 02 01 32 81 10 00 FF 02 24 FF 01 02 0E FF 03 03 30 00
   83 * 18	 02 01 33 81 0C 00 FF 02 31 00 16 16 32 00 33 33 30 00
   84 * 9 	 02 01 40 01 01 05 00 05 00
   85 * 10	 03 01 01 46 01 FF 40 00 33 00
Idea was to have first part of consist with capacity 0, and second with capacity 20 passengers (I set capacity of 20 passengers in Action0 prop. 0F). But vehicle shows capacity of 20 passengers only in purchase list, but in game has capacity 40 passengers. (With OTTD all works correct.) I even made other Callback 36, which sets capacity to 20 passengers, and applied it to second part before consist forming, but still same error appears. What I am doing wrong?
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Coding aRVs with different capacity for each part

Post by PikkaBird »

It's showing the wrong capacity in the buy menu because you're not building the articulated vehicle there. With trains, you can use callback 15 to show the correct capacity for artics in the buy menu, I don't know if that works for RVs.

Callback 36 for capacity is not supported in TTDP yet, so that's why it won't work there. :)
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

Yes, I haven't noticed that CB 36 is supported for OTTD only. So that's another thing (other is CB 1D) that I am waiting for. :) (Suggestion for DaleStan: NFO Renum haven't said that CB 36 isn't supported, but for CB 1D it says.)
And actually it's showed wrong capacity in game, I intended to be 0+20, but in game shows 40 passengers.
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Coding aRVs with different capacity for each part

Post by PikkaBird »

Wile E. Coyote wrote:Yes, I haven't noticed that CB 36 is supported for OTTD only. So that's another thing (other is CB 1D) that I am waiting for. :) (Suggestion for DaleStan: NFO Renum haven't said that CB 36 isn't supported, but for CB 1D it says.)
And actually it's showed wrong capacity in game, I intended to be 0+20, but in game shows 40 passengers.
Callback 36 is supported, though... just not setting that particular property.
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

But, as I saw in Wiki, it's only supported for trains? I saw that for RVs CB36 is only supported in OTTD (and only props 0F and 11).
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Coding aRVs with different capacity for each part

Post by Lakie »

In the buy menu it appears that articulated road vehicles do not show the correct capacity, this is something I've also noticed.
They tend to show the capacity of the first unit of the articulated road vehicle's type capacity.

~ 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
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

In that case I have very strange behaviour with my code: first unit has capacity 0, second has 20, in buy menu it's shown 20, but in game capacity is 40 (Action 0 prop. 0F is set to 20).

But I suppose it's consequence of using non-available callback.
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Coding aRVs with different capacity for each part

Post by Lakie »

Unless I'm missing something, callback 15 is used for refitting, and the buy menu uses the action0 property value, hence 20 would be the expected result...

~ 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
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Coding aRVs with different capacity for each part

Post by PikkaBird »

Wile E. Coyote wrote:In that case I have very strange behaviour with my code: first unit has capacity 0
Only after it's run the callback, which it hasn't. :roll:
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

Lakie wrote:Unless I'm missing something, callback 15 is used for refitting, and the buy menu uses the action0 property value, hence 20 would be the expected result...
That confused me too. :?
PikkaBird wrote:
Wile E. Coyote wrote:In that case I have very strange behaviour with my code: first unit has capacity 0
Only after it's run the callback, which it hasn't. :roll:
Hm... I missed something... isn't callback ran in sprites 78 and 79? :?

BTW, in OTTD in buy list there is showed capacity 20, and in vehicle info window first unit has capacity 0, and second 20 (that is just what I intended).
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: Coding aRVs with different capacity for each part

Post by peter1138 »

I'm not quite getting this. Are you using a callback which isn't supported in TTDPatch, and you're wondering why it does not work?
He's like, some kind of OpenTTD developer.
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

I wondered because I haven't knew that callback isn't supported (my mistake :oops: ). Now all is clear, I couldn't do this in Patch, only in OTTD. But now I wonder why it shows doubled capacity, due to thing Lakie said that because there is no callback support it should be used property from Action 0. Nevertheless, with OTTD which supports this callback all is working in way I wanted. :)

Just one question for OTTD: is it possible to make unit which has no capacity not to show "Empty" in vehicle info window, but to show nothing (like locomotive in train consist)?
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Coding aRVs with different capacity for each part

Post by Lakie »

Because in TTDpatch it goes through the consist and adds all the cargo capacities together and shows the total cargo and capacity of the articulated road vehicle.
Not sure how OpenTTD shows this information though.
(Also remember an articulated road vehicle is not a train and making it look like one would be confusing to users as you cannot do the same things to them)...

~ 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
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Coding aRVs with different capacity for each part

Post by PikkaBird »

Wile E. Coyote wrote:Hm... I missed something... isn't callback ran in sprites 78 and 79? :?
Not in the buy menu, no.

Your buy menu chain looks like this:

Code: Select all

84 * 9     02 01 40 01 01 05 00 05 00
85 * 10    03 01 01 46 01 FF 40 00 33 00
No callback there... :P
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

Lakie wrote:Because in TTDpatch it goes through the consist and adds all the cargo capacities together and shows the total cargo and capacity of the articulated road vehicle.
Is there any way to avoid that adding?
PikkaBird wrote:No callback there... :P
Whoops, you're right... My mistake. :oops:

EDIT: I did that, but capacity in buy menu is still not equal as capacity in game:

Code: Select all

   80 * 9	  02 01 40 01 01 00 00 00 00
   81 * 10	 02 01 41 81 41 00 01 01 40 00 00 00 28 00
   82 * 14	 02 01 42 81 10 00 FF 01 46 FF 01 01 FF FF
   83 * 14	 02 01 43 81 0C 00 FF 01 42 00 16 16 40 00
   84 * 10	 03 01 01 46 01 FF 43 00 33 00
What did I do wrong now?
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Coding aRVs with different capacity for each part

Post by Lakie »

Not currently, and because its the way train articulated units work I am very reluctant to remove it.
As I've said they are not trains and they work quite differently from trains in both OpenTTD and TTDpatch.

Currently neither show articulated road vehicles like trains thus not having the totals would just be confusing (You must remember that the total can include up to 2/3 different cargo types).

[Edit] I don't think using a variable 41 in the buy menu would work as there is no consist at that point in time...
You should just return the final total capacity of the articulated road vehicle instead for the buy menu?

And as previously said for TTDpatch it requires a fix minor alterations to work better, such as trying to loop the consist in a theoretical sense.

~ 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
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Coding aRVs with different capacity for each part

Post by Wile E. Coyote »

Lakie wrote:Not currently, and because its the way train articulated units work I am very reluctant to remove it.
As I've said they are not trains and they work quite differently from trains in both OpenTTD and TTDpatch.
Of course, you're absolutely right about that, I'm also against that removing (and probably others too).
Lakie wrote:I don't think using a variable 41 in the buy menu would work as there is no consist at that point in time...
It worked for articulated train wagons so I supposed it should work here too.
Lakie wrote:You should just return the final total capacity of the articulated road vehicle instead for the buy menu?
But how to do that when CB36 is not supported?
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Coding aRVs with different capacity for each part

Post by Lakie »

As previously said, I recognise its a bug in TTDpatch, however I will not be adding cargo support through callback 36, I will merely fix TTDpatch's cargo consist calculations for the buy menu when I feel like doing any TTDpatch developing.

~ 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
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Coding aRVs with different capacity for each part

Post by PikkaBird »

Wile E. Coyote wrote:
Lakie wrote:You should just return the final total capacity of the articulated road vehicle instead for the buy menu?
But how to do that when CB36 is not supported?
Edit: no you don't, silly me. :roll:
Last edited by PikkaBird on 15 Jun 2008 05:40, edited 1 time in total.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Coding aRVs with different capacity for each part

Post by michael blunck »

[total capacity]
PikkaBird wrote:For articulated trains, you use callback 15 in the buy menu to set the cargo amount.
IIRC, CB16.

regards
Michael
Image
Post Reply

Return to “General TTDPatch”

Who is online

Users browsing this forum: No registered users and 18 guests