"If" statments in engine configs

TSwenson

Active member
My question is simple, would it be possible to put an 'if' statement in an engine config file? My thought is to be able to have a single config file that would work for different versions so as to eliminate problems such as the issue with steam locomotives between TC3 (I think that was when the change was made) and earlier versions. Thanks for your input.

TSwenson
 
My question is simple, would it be possible to put an 'if' statement in an engine config file? My thought is to be able to have a single config file that would work for different versions so as to eliminate problems such as the issue with steam locomotives between TC3 (I think that was when the change was made) and earlier versions. Thanks for your input.

TSwenson

Raise the question in trainzdev. Off hand I think there is some other slight change than just the engine spec. You could include an alternative config.txt file I suppose.

Cheerio John
 
No "If" about it

Apparently it is "unfortunately" not possible to put in an 'if' statement to change the engine configuration. Thanks to John fro getting me in the right direction for my answer.
 
While this isn't possible in config.txt, I wonder if it might be possible in a loco's script. The GameScript API lists some loco and vehicle functions which allow a few parameters to be set, but I don't know if enough are included to be useful to you. A script can easily get the Trainz version and build number and execute code conditionally on it.

HTH, John
 
From what I understand, it may be possible to make two engine configurations that would be included with a model and an 'if' statement in the model itself that would change to the correct configuration based upon the version that it is running on. This was a bit more involved than I was hoping it was, but not an insurmountable problem.
 
Sorry TS, afaik, what you want to do is not possible. No if statements in configs and no conditional initiations in models. Some things can be changed after initation thru scripting but none of the items in the steam container are user setable thru script.

Current state of the game requires 2 steam-engine configs and only 1 can be referenced in the enginespec tag at a time. That to me means 2 version of the loco's config file which if you want them to exist along side each other means 2 different loco assets with unique kuids.

Edit: Of course people are free to edit loco config files and reference any steam-engine spec they care to which is basicaly where we're at today on the new vs old steam question.

Bob Pearson
 
Last edited:
Thanks, this confirms what I was afraid of. Looks like we just have to wait wile new engine configs get made for our favorite steam locomotives.
 
My question is simple, would it be possible to put an 'if' statement in an engine config file? My thought is to be able to have a single config file that would work for different versions so as to eliminate problems such as the issue with steam locomotives between TC3 (I think that was when the change was made) and earlier versions. Thanks for your input.

TSwenson

I've seen this handled in two ways. One upload a new version that is TC3 and above compliant, the older version is still on the DLS if you search by kuid, the second way is to do the first so that people will automatically pick up the update and also to create a TRS2004 version which gets posted on the DLS.

For example do a search on nawlins locomotives with all the boxes checked and you'll see two Remuses one TRS2004, the other TC3.

Cheerio John
 
Instead of using If statements, is it possible to use some kind of version/build checker and then some kind of include statement it append the proper configuration file depending upon the version?

I think this might be another way to go about the same issue.

John
 
Back
Top