Using callbacks to change wagon properties
Posted: 22 Feb 2009 03:45
Hi all,
I've only recently gotten back into creating new graphics for TTDPatch, and as a former coder I would like to brush up on my skills so that hopefully I can help a set or two get completed.
One thing that puzzles me, despite hunting around on here and on the TTDPatch Wiki for an hour or so is just to what extent callbacks can be used to change various wagon properties. It is my understanding that:
- A wagon length can be changed
- A wagon can be prevented from being added to a train
- A wagon's properties can be changed
...Along with a whole load of other stuff (I really want to get the hang of coding again, as deep down I've been a computer programmer for 21 years).
Am I right in thinking that if there is a need to drastically reduce the number of vehicle IDs that are used by rolling stock, this can be achieved by having say just three or four different items of rolling stock, each then refittable as needed, grouped by similar cargo types, and setting which lead vehicle-type it can and cannot be added to? If so, whilst making the coding a nightmare, it will greatly free up the number of vehicle IDs to be used elsewhere.
That paragraph is a bit of a mess, so an example I was thinking of:
- A vehicle ID could be used for a purely cosmetic brake van to run in the set.
- This brake van could be of different length, speed limit, etc., depending on which train-engine is used.
- The brake van can also be banned from being added behind certain train-engines, eg. to disallow adding it to the rear of a modern DMU.
- The brake van can also 'double up' as a tender for steam locomotives using articulated vehicle callbacks.
How many of the above assumptions are true, close but no cigar, or just wildly laughable? As I say, I would really like to get my hand back into coding as it seems to me that there are a lot of sets that have artists but are lacking a coding, and as I have an awful lot of free time on my hands these days (my 'day job' is to do nothing, believe it or not!), so any help given could be mutually benefitial to the TTD community.
Ronnie
I've only recently gotten back into creating new graphics for TTDPatch, and as a former coder I would like to brush up on my skills so that hopefully I can help a set or two get completed.
One thing that puzzles me, despite hunting around on here and on the TTDPatch Wiki for an hour or so is just to what extent callbacks can be used to change various wagon properties. It is my understanding that:
- A wagon length can be changed
- A wagon can be prevented from being added to a train
- A wagon's properties can be changed
...Along with a whole load of other stuff (I really want to get the hang of coding again, as deep down I've been a computer programmer for 21 years).
Am I right in thinking that if there is a need to drastically reduce the number of vehicle IDs that are used by rolling stock, this can be achieved by having say just three or four different items of rolling stock, each then refittable as needed, grouped by similar cargo types, and setting which lead vehicle-type it can and cannot be added to? If so, whilst making the coding a nightmare, it will greatly free up the number of vehicle IDs to be used elsewhere.
That paragraph is a bit of a mess, so an example I was thinking of:
- A vehicle ID could be used for a purely cosmetic brake van to run in the set.
- This brake van could be of different length, speed limit, etc., depending on which train-engine is used.
- The brake van can also be banned from being added behind certain train-engines, eg. to disallow adding it to the rear of a modern DMU.
- The brake van can also 'double up' as a tender for steam locomotives using articulated vehicle callbacks.
How many of the above assumptions are true, close but no cigar, or just wildly laughable? As I say, I would really like to get my hand back into coding as it seems to me that there are a lot of sets that have artists but are lacking a coding, and as I have an awful lot of free time on my hands these days (my 'day job' is to do nothing, believe it or not!), so any help given could be mutually benefitial to the TTD community.
Ronnie