Add track-side using script

chinmay.gadre

New member
I am able to add track-side assets (signals to be specific) from script using SetFXAttachment (I had to play around with the attachment point positions but that was easy). However, the signals do not seem to work. I am assuming this may be due to the fact that the track-side may not be "associated" with a track.

Has anyone tried this OR can anyone provide some suggestions?
 
I cannot answer your question but I am puzzled. Why would you need to add a track signal using a script?

All signals (signal objects) are added to track (no attachment points needed AFAIK) in Surveyor. These include invisible signals where you want them to influence the notoriously misbehaved AI ("Artificial Idiot") and you can control signals using the Enhanced Signal Rule and the various Interlocking Tower Rules, but I cannot think of an application where a signal would be need to be added "on the fly" by a script.
 
Hi.

Signals are trackside assets of kind "mosignal" that are directly placed on a track to be recognized and included in the global signaling system managed by trainz. By using SetFXAttachment, you may add a specific signal mesh to an existing asset, but it will not be recognized as a valid main "mosignal" asset and so will not be included in the global signaling system.

Sorry, but I don't think what you want to do is possible : signals cannot be added on the fly to a route and session by a script.

The only thing you may look at is to add your signal in a specific layer and you can by script enable or disable a layer. But I don't know if enabling or disabling a layer with signals will only change the signal visibility, or if it will add and remove the signal from the global signaling system … You may try ...

Regards.
Pierre.
 
The only thing you may look at is to add your signal in a specific layer and you can by script enable or disable a layer. But I don't know if enabling or disabling a layer with signals will only change the signal visibility, or if it will add and remove the signal from the global signaling system

I recall doing that exact experiment many years ago when layers first came out. The result, from memory, was that a red signal in a hidden layer will still stop any AI controlled trains.
 
I cannot answer your question but I am puzzled. Why would you need to add a track signal using a script?

All signals (signal objects) are added to track (no attachment points needed AFAIK) in Surveyor. These include invisible signals where you want them to influence the notoriously misbehaved AI ("Artificial Idiot") and you can control signals using the Enhanced Signal Rule and the various Interlocking Tower Rules, but I cannot think of an application where a signal would be need to be added "on the fly" by a script.

I am evaluating creating an asset for yard operations where the signals and junctions would be in the yard master's control (theoretically). Rather than a route builder having to manually add / associate signals and junctions in the yard, I was trying to see if this could be achieved via the script.
 
My best theory on how to do that would be in how the signals are named. For example: In a yard which has a control box named "River Yard" all the signals and points in that yard that are to be automatically placed under the control of that box would have names beginning with "RY" - e.g. a signal "RY104A" or a switch "RY_27B".
 
Back
Top