.
Results 1 to 14 of 14

Thread: error with uploaded reefers in script

  1. #1
    Join Date
    Feb 2007
    Location
    United States of America, ill, Rock Island
    Posts
    1,532
     

    Default error with uploaded reefers in script

    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>
    Modeling Ho scale on the cheap

    GT 730 8 Meg

  2. #2
    Join Date
    Nov 2006
    Location
    Australia, Qld
    Posts
    7,380
     

    Default

    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/...ript_functions
    Tony Hilliam

    Got questions about TRS19? Click here for TRS19 FAQs

    Looking for answers to in-game functionality? Click here for help

  3. #3
    Join Date
    Nov 2006
    Location
    Canada, Ontario, Ottawa
    Posts
    14,327
     

    Default

    Quote Originally Posted by Tony_Hilliam View Post
    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/...ript_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

  4. #4
    Join Date
    Nov 2006
    Location
    United States of America, South Jersey
    Posts
    2,207
    Blog Entries
    1
     

    Default

    Quote Originally Posted by johnwhelan View Post
    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 by RPearson; June 23rd, 2022 at 11:36 AM.
    TRAINZ-UTC-TRS04-TRS06-TC1&2-TC3-TS09-TS10-TS12-TANE(TEG)-TMR17-TRS19-TRS22
    Member since 6-14-2002

  5. #5
    Join Date
    Nov 2006
    Location
    Canada, Ontario, Ottawa
    Posts
    14,327
     

    Default

    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

  6. #6
    Join Date
    Nov 2006
    Location
    United States of America, South Jersey
    Posts
    2,207
    Blog Entries
    1
     

    Default

    Quote Originally Posted by johnwhelan View Post
    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
    TRAINZ-UTC-TRS04-TRS06-TC1&2-TC3-TS09-TS10-TS12-TANE(TEG)-TMR17-TRS19-TRS22
    Member since 6-14-2002

  7. #7
    Join Date
    Nov 2006
    Location
    Canada, Ontario, Ottawa
    Posts
    14,327
     

    Default

    Quote Originally Posted by RPearson View Post
    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

    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

  8. #8
    Join Date
    Nov 2006
    Location
    Australia, QLD, Pimpama
    Posts
    9,296
    Blog Entries
    30
     

    Default

    Quote Originally Posted by RPearson View Post
    .... 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.

    Paul


  9. #9
    Join Date
    Nov 2006
    Location
    Australia, QLD, Pimpama
    Posts
    9,296
    Blog Entries
    30
     

    Default

    Quote Originally Posted by johnwhelan View Post
    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

    Paul


  10. #10
    Join Date
    Nov 2006
    Location
    Canada, Ontario, Ottawa
    Posts
    14,327
     

    Default

    Quote Originally Posted by pcas1986 View Post
    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

  11. #11
    Join Date
    Feb 2007
    Location
    United States of America, ill, Rock Island
    Posts
    1,532
     

    Default

    pm'd majekear asking if i could change his script file. with the change to it as above.
    Modeling Ho scale on the cheap

    GT 730 8 Meg

  12. #12
    Join Date
    Nov 2006
    Location
    Australia, QLD, Pimpama
    Posts
    9,296
    Blog Entries
    30
     

    Default

    Quote Originally Posted by johnwhelan View Post
    ... 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.

    Paul


  13. #13
    Join Date
    Nov 2006
    Location
    United States of America, Louisiana, New Orleans
    Posts
    497
     

    Default

    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.

  14. #14
    Join Date
    Feb 2007
    Location
    United States of America, ill, Rock Island
    Posts
    1,532
     

    Default

    thank you for resoponding. looked at the it, domt see anything about needing permission etc.
    Modeling Ho scale on the cheap

    GT 730 8 Meg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •