Needing some help in coding of articulated trains...

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
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

Hi there,

well, here I am again. I've had some things to do in my real life, i. e. finishing school, but now there will be a bit more time for important things like... TTD.

By now, I'm struggling with this vehicle once more. Nearly everything now works as intended, but the unpowered driving trailer keeps fuming around.

Setting property 22 has no effect on this which should be obvious, I think, because the second part is only an articulated part of the vehicle without power.
The powered wagons callback also does not work for that.

Every tested combination of this did not solve the problem.

Any help is appreciated :)

Greetz,
Regiovogel
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Needing some help in coding of articulated trains...

Post by michael blunck »

Ah! I had nearly forgotten about this, hehe. 8)
Regiovogel wrote:[...] the unpowered driving trailer keeps fuming around.

Setting property 22 has no effect on this which should be obvious, I think,
because the second part is only an articulated part of the vehicle without
power.
The powered wagons callback also does not work for that.
Well, it should work. Just add something like this into the .nfo shown at the first page of this thread:

Code: Select all

// callbacks power & fume
-1 * 16         02 00 05 81 40 80 FF 00 02 01 // MOD 2 wg. evtl Vielfachsteuerung (?)
                        40 FF 01 01     // coach: no fume
                        24 FF           // engine: diesel fume

// callbacks Lok
-1 * 26      02 00 06 81 0C 00 FF 04
                        05 00 10 10     // power & fume
                        ....            // more CBs go here
HTH
regards
Michael
Image
User avatar
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

Hi Michael,

thank you for your answer. I'm afraid it still doesn't work as it should.

The flag for this callback is set, so it should be called. Somehow I got the impression that the driving trailer emits less fumes, but they are still present ;)

It also doesn't matter whether I set the power for added wagons to 0 or any other value.

Well, thanks for your help!
Regiovogel
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Needing some help in coding of articulated trains...

Post by DaleStan »

If it's still not working, post the GRF, grfdebug.log (generated by Cht:Grfdebug), and grfdebug.txt (generated by the log parser in my signature), and identify the lines that are either incorrect or not present.
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
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Needing some help in coding of articulated trains...

Post by michael blunck »

@Regiovogel

For a first attempt, the .nfo listing would be sufficient.

regards
Michael
Image
User avatar
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

Well, I attached the .grf and the .nfo.

As I'm working with OTTD, I'm not able to generate grfdebug.log (or at least, I don't know how). Enabling the debug level for newgrfs didn't do anything.
My installation of TTDPatch got somehow corrupted ("Registry-Fehler 4" when trying to start it), and I have no idea how to bring it back to life...

Hopefully this two files are sufficient.

Clueless :?,
Regiovogel

p.s.: If you are missing some comments in the .nfo, this is because it's created with GRFMaker...
Attachments
627_628.nfo
(4.11 KiB) Downloaded 89 times
627_628w.grf
(8.71 KiB) Downloaded 103 times
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Needing some help in coding of articulated trains...

Post by michael blunck »

Don´t you have a commented and more structured .nfo?? This would make things much easier, well not for me, but for you.

regards
Michael
Image
User avatar
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

To be honestly - no. As I said, I'm working with GRFMaker. It's well structured and commented in there ;)
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: Needing some help in coding of articulated trains...

Post by AndersI »

Regiovogel wrote:I'm working with GRFMaker. It's well structured and commented in there ;)
You can mark all your GRFMaker comments to be retained in the .nfo - that makes it much more readable.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Needing some help in coding of articulated trains...

Post by DaleStan »

Oh. GRFMaker. That, unfortunately, makes helping you much harder.
Regiovogel wrote:("Registry-Fehler 4" when trying to start it)
Remove the registry key "HKLM\Software\Fish Technology Group\Transport Tycoon Deluxe", or add "debugswitches n+" to ttdpatch.cfg.
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
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Needing some help in coding of articulated trains...

Post by michael blunck »

Regiovogel wrote: [...] As I'm working with OTTD [...] My installation of TTDPatch got somehow corrupted ("Registry-Fehler 4" when trying to start it) [...]
As Dale said.

BTW, your .grf seems to work OK in TTDPatch. Please be aware that OTTD still doesn´t comply to the full newgrf standard.

regards
Michael
Image
User avatar
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

AndersI wrote:You can mark all your GRFMaker comments to be retained in the .nfo - that makes it much more readable.
Ah, just tried it out. Thanks.
DaleStan wrote:Oh. GRFMaker. That, unfortunately, makes helping you much harder.
I'm sorry about that, but IMO it makes coding a lot easier :)

TTDPatch is now working again.
michael blunck wrote:BTW, your .grf seems to work OK in TTDPatch.
Since I'm able to check it myself now, I also found it working correctly.
michael blunck wrote:Please be aware that OTTD still doesn´t comply to the full newgrf standard.
Well, that's right. I created a bug report for that...

BTW, is callback 36 (change vehicle properties) not thought to be called in the purchase list? In OTTD it works, in TTDPatch the value of action 0 is used instead. The specs don't tell anything about that...


Thank you all for your help!
Regiovogel
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Needing some help in coding of articulated trains...

Post by Lakie »

Which property of callback 36 is malfunctioning?
Also if you use Cargo Type FF (Buy Menu) for sprites and such you'll need to give callback returns there for them to affect the buy menu values. ;)

~ 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
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

The used code for the purchase list (and only there) is the following:

Code: Select all

54 * 14	 02 00 0F 81 10 00 FF 01 92 80 14 14 00 00
It should set property 14, the displayed cargo capacity, to 146 (and in OTTD, it does). TTDPatch shows a capacity of 73 passengers which is only correct for one of the parts of the train. Since it keeps the code a bit easier to read, I'd like to use this callback instead of an articulated callback there.
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Needing some help in coding of articulated trains...

Post by Lakie »

Works fine here with my test grf and the latest nightly, so I assume you are using the wrong version of TTDpatch, or something isn't quite right with the grf?

~ 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
Regiovogel
Engineer
Engineer
Posts: 48
Joined: 03 Feb 2008 23:25
Location: Nürnberg, Germany

Re: Needing some help in coding of articulated trains...

Post by Regiovogel »

OK, with the latest nightly, it works. It only didn't work in 2.5 beta 9. I'll check the date of the version next time ;)

Sorry for the confusion then!
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Needing some help in coding of articulated trains...

Post by Lakie »

As its a feature, it will not be in the 2.5 stable branch, it is however in the nightlies (2.6 branch).

~ 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."
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Needing some help in coding of articulated trains...

Post by michael blunck »

Regiovogel wrote: [setting CB36 in the purchase window]
Since it keeps the code a bit easier to read, I'd like to use this callback instead of an articulated callback there.
I don´t think so. For reasons of consistency, I´d prefer to achieve the same results using CB 16.

@Lakie
How´s the current status with capacity and weight of articulated vehicles and CB16? Will we dependant on the above workaround forever? :P

regards
Michael
Image
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Needing some help in coding of articulated trains...

Post by Lakie »

[Edit] Of course it doesn't because I had to hook them and aRV's doesn't work like that either...
I can have a look at it although its likely to break people using callback 36 to trick it.

~ 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."
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot], broodje and 33 guests