error with uploaded reefers in script

fourteen

Active member
not sure how to fix this. thanks.

An Error Occured with <kuid:327871:100830> Rock Island 40ft Reefer V1 #
<kuid:327871:100830> : VE197: Syntax error in script 'reefer3lodi.gs' for asset <kuid:327871:100830> "Rock Island 40ft Reefer V1 #"
<kuid:327871:100830> : VE267: reefer3lodi.gs(397) : member MESSAGE_BROADCAST is obsolete in object Router.

file to big to show all of it

but here is the part that is wroung? maybe

Message msg;
int m_target = Router.MESSAGE_BROADCAST;

cloned from 40ft Reefer Illinois Central MDT #d
<kuid2:56063:100656:2>
 
The script uses obsolete functions.

the script APIs themselves say:
// Obsolete, do not use.
// Message broadcasting causes every script object to be sent a message. This
// is very inefficient, as most nodes won't want the message, and unneccessary,
// as Sniff can be used to be notified of specific messages on objects.
// Note that in future versions scripts attempting to post or receive
// broadcast messages may trigger script exceptions and/or error logs.
public obsolete define int MESSAGE_BROADCAST = 0;

Visit the wiki page here for more info on fixing obsolete scripts:
https://online.ts2009.com/mediaWiki/index.php/HowTo/Upgrade_obsolete_script_functions
 
The script uses obsolete functions.

the script APIs themselves say:
// Obsolete, do not use.
// Message broadcasting causes every script object to be sent a message. This
// is very inefficient, as most nodes won't want the message, and unneccessary,
// as Sniff can be used to be notified of specific messages on objects.
// Note that in future versions scripts attempting to post or receive
// broadcast messages may trigger script exceptions and/or error logs.
public obsolete define int MESSAGE_BROADCAST = 0;

Visit the wiki page here for more info on fixing obsolete scripts:
https://online.ts2009.com/mediaWiki/index.php/HowTo/Upgrade_obsolete_script_functions

Is it time to look at scripting and see if we can come up with a number of either certified scripts or standard scripts that can be used by content creators and I don't mean complex ones that do many things. The broadcast comment is of interest as many of the coupling scripts for UK assets I believe used it so what will replace those scripts?

Thanks

Cheerio John
 
Is it time to look at scripting and see if we can come up with a number of either certified scripts or standard scripts that can be used by content creators and I don't mean complex ones that do many things. The broadcast comment is of interest as many of the coupling scripts for UK assets I believe used it so what will replace those scripts?

Thanks

Cheerio John
In another thread Tony has already put out the call to hire some part time workers with Trainz scripting experience to start updating older and broken scripts on the DLS.

For the 'reefer3lodi.gs' script, I'm in the process of updating a version of that script for Majekear. The new version will be maintained in a library asset so it can be modified and updated very easily. The older assets using older variations of the script have their own copy of the script included in each asset. So updating each individual script is a nightmare. The reason I suggested to Majekear to switch to a central library holding all the updated scripts and use the "script-include-table" container in the config as required so the asset has access to script(s) as required, is to avoid problems like this in the future.

<kuid:327871:100830> : VE267: reefer3lodi.gs(397) : member MESSAGE_BROADCAST is obsolete in object Router. - I didn't write this section of the above script. It was part of the script I was given to fix - way back in TRS06 IIRC. So it's been around 15 years or so. The part throwing the error controls the visual effects when coupling cars.

Technically I don't have clear permission to change this part of the script due to possible copyright infringements but if the original author of that code wants to object he is free to do so. In the mean time I'll change this in the new version of the script. This will only eliminate the error on new versions of the cars.

That's the easy part. To fix existing content requires editing the existing script. But has to be done on each and every asset using this or a similar script.

Bob Pearson
 
Last edited:
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
 
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; [COLOR="#FF0000"]<-- change this line to //int m_target = Router.MESSAGE_BROADCAST; 
                                                  OR DELETE IT to clear error[/COLOR]

    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
 
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; [COLOR=#FF0000]<-- change this line to //int m_target = Router.MESSAGE_BROADCAST; 
                                                  OR DELETE IT to clear error[/COLOR]

    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


I was thinking more generally about reskins and how to fix them up. Generally speaking the person who created the mesh and set the script up is unable to correct any reskins.

Cheerio John
 
.... So updating each individual script is a nightmare. ...

Bob Pearson

Yes, as we found with those 2000+ Russian switches that all used the same rdsjunc.gs script. Fortunately, N3V stepped in to take on the problem.

Even if N3V does manage to repair some of those code libraries there must be 100's, if not 1000's, of scripted assets on the DLS with latent problems.
 
I was thinking more generally about reskins and how to fix them up. Generally speaking the person who created the mesh and set the script up is unable to correct any reskins.

Cheerio John

John,
Is there a particular problem with reskins?

The "standard" way of repairing reskins is using that small script to swap textures in the Init() method. That works ok but can be unreliable for LODed models and especially if, say, the lowest LOD model uses a different material
 
John,
Is there a particular problem with reskins?

The "standard" way of repairing reskins is using that small script to swap textures in the Init() method. That works ok but can be unreliable for LODed models and especially if, say, the lowest LOD model uses a different material

Over the years a lot of my work has been reskinned. Then a new version of trainz comes out or even a service pack and the asset needs fixing. I can fix the originals but not the reskins which are under a different kuid. For script errors not having the script in the asset would at least help.

Cheerio John
 
... For script errors not having the script in the asset would at least help.

Cheerio John
That, I imagine, would need a completely new way of doing reskins.

I'm not a fan of reskins and never have been. There are so many issues with them that I tend to ignore those broken reskins in the CRG list in favour of something worth fixing.
 
fourteen........first, I have not read all the post here to your posting. Any script used were not created by me. So I really can't give you permission to edit. Also, in the description tag of the car's config.txt file is indication of those who create any script used. However, most scripts were created to be used without restriction. So I would look in the config.txt file of the script being used to see if permission to edit is needed. As to me, I have basically zero script writing ability. Therefore, I am trusting in those responding here to help you with the problem. RPearson has posted here and he is currently the person who is helping with any script problems I need or encounter. If he can't help, I do not know who can. Thanks for your interest in the Reefer.
 
Back
Top