
Originally Posted by
johnwhelan
Much like Andrea did with the JAG scripts. I like the approach but it means somewhere we need to document it for content creators and those who reskin.
Cheerio John
Not sure what and where it has to be documented as a new script will be used with the any new cars that are uploaded. Reskinners using the new cars will use the new script unless they replace it in the configs with their own or different one. For old cars that are reskinned the reskinner is on the hook to verify his upload meets current standards.
As a follow on I have looked at the code (see below) and I'm a bit confused because as far as I can see the script doesn't actually use the Router.MESSAGE_BROADCAST member it assigns to the int variable m_target. NO MESSAGES ARE SENT using this as a destination.
Is the new check only testing for presence of "Router.MESSAGE_BROADCAST"? This script does not and cannot as coded broadcast messages to every node in the Router.
You only need to comment out or just delete line 397, "int m_target = Router.MESSAGE_BROADCAST;", to clear the error flagged by the compiler. I've already deleted it in the new version of the script I'm working on. Actually, I did it some time ago since Rene and I have both had some starts, stops and long delays with this update - real life and frustrations with Trainz occasionally getting in the way.
Code:
thread void CarMonitor(void) {
Message msg;
int m_target = Router.MESSAGE_BROADCAST; <-- change this line to //int m_target = Router.MESSAGE_BROADCAST;
OR DELETE IT to clear error
while (status != CAR_DERAILED) {
if (status and DoUpdate) {
DoUpdate = 0;
DecoupleHoses(status, GetDirectionRelativeToTrain());
UpdateGear();
}
wait() {
on "Vehicle", "BadCouple", msg: {
}
on "Vehicle", "Coupled", msg: {
}
on "Vehicle", "Decoupled", msg: {
}
on "Vehicle", "Derailed", msg: {
if (msg.src == me) { status = CAR_DERAILED; break; }
}
on "World", "ModuleInit": {
status = CarCheck();
SetGear(status, GetDirectionRelativeToTrain());
}
}
status = CarCheck();
}
}
Bob Pearson