Page 2 of 2

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

Posted: 05 Feb 2008 19:55
by michael blunck
@Regiovogel

Weight could be a problem, but capacity should come out right. Again: the key is to have CB 16 in the "purchase window chain" too, so all the constituent vehicles could be summed up properly.


@DaleStan

Thanks for the information.

regards
Michael

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

Posted: 14 Jul 2008 15:50
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

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

Posted: 14 Jul 2008 17:54
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

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

Posted: 17 Jul 2008 12:56
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

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

Posted: 24 Jul 2008 05:59
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.

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

Posted: 24 Jul 2008 08:06
by michael blunck
@Regiovogel

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

regards
Michael

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

Posted: 24 Jul 2008 09:40
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...

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

Posted: 24 Jul 2008 09:52
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

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

Posted: 24 Jul 2008 10:28
by Regiovogel
To be honestly - no. As I said, I'm working with GRFMaker. It's well structured and commented in there ;)

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

Posted: 24 Jul 2008 17:34
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.

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

Posted: 26 Jul 2008 06:00
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.

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

Posted: 26 Jul 2008 07:49
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

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

Posted: 26 Jul 2008 21:42
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

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

Posted: 26 Jul 2008 21:50
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

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

Posted: 26 Jul 2008 22:07
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.

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

Posted: 26 Jul 2008 22:18
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

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

Posted: 27 Jul 2008 10:03
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!

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

Posted: 27 Jul 2008 22:58
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

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

Posted: 28 Jul 2008 06:52
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

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

Posted: 28 Jul 2008 10:47
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