Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline fabstar68  
#1 Posted : 05 August 2025 16:29:45(UTC)
fabstar68

Italy   
Joined: 14/12/2023(UTC)
Posts: 62
Location: Milan
Hi all,

i am trying to set up a script and i want it to be executed every time that a certain sensor is trigger. but this sensor is not related to a train passing in a certain block, it is linked to the viessmann car motion (i.e. a veichle passing on a certain spot).

i am having difficulties to implement this in rocrail, because it seems that the "on" event in a sensor is triggered only if that sensor is associated to a certain block event (in, exit, etc.). instead, i need to define those sensors in a "stannd-alone" way. i hope i have managed to express clearly my need. Thanks

Fab

Offline applor  
#2 Posted : 06 August 2025 04:27:27(UTC)
applor

Australia   
Joined: 21/05/2004(UTC)
Posts: 1,778
Location: Brisbane, Queensland
You need to use actions with Output (CO) objects.
Configure an action on the sensor to turn the CO on (sensor properties, general, Actions - change the CO state to 'on').
You then configure an action on the CO to do the change you want ( see example below)

This way as soon as the sensor is triggered the Output turns on and stays on, you then have another action on a different sensor to turn the Output off again (to reset it).

You can't use the sensors directly with doing the change because the sensors flicker like crazy and don't stay on, so the change you want to action gets spammed like crazy because it constantly goes on and off.


Example: This Action configured on the CO will set the train currently allocated in block 92 to change speed to cruise and turn the sound on 3 seconds after triggered.
I use this when a train triggers a sensor near the exit of a tunnel from the staging yard, reduces speed from Max to Cruise and then turns the sound on.

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>
<query vr="lcid92" table="bklist" id="92" get="locid"/>
<lc id="@lcid92" V_hint="cruise"/>
<sleep time="3000"/>
<fn id="@lcid92" fndesc="Sound" fncmd="on"/>
</xmlscript>

Please note that the block does not trigger the event at all but the system uses the trains last location (block 92) to determine which train to apply the changes to.
This works not only for occupied blocks but also reserved or departing or crossing.
modelling era IIIa (1951-1955) Germany
thanks 1 user liked this useful post by applor
Offline fabstar68  
#3 Posted : 06 August 2025 08:58:46(UTC)
fabstar68

Italy   
Joined: 14/12/2023(UTC)
Posts: 62
Location: Milan
Originally Posted by: applor Go to Quoted Post
You need to use actions with Output (CO) objects.
Configure an action on the sensor to turn the CO on (sensor properties, general, Actions - change the CO state to 'on').
You then configure an action on the CO to do the change you want ( see example below)

This way as soon as the sensor is triggered the Output turns on and stays on, you then have another action on a different sensor to turn the Output off again (to reset it).

You can't use the sensors directly with doing the change because the sensors flicker like crazy and don't stay on, so the change you want to action gets spammed like crazy because it constantly goes on and off.


Example: This Action configured on the CO will set the train currently allocated in block 92 to change speed to cruise and turn the sound on 3 seconds after triggered.
I use this when a train triggers a sensor near the exit of a tunnel from the staging yard, reduces speed from Max to Cruise and then turns the sound on.

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>
<query vr="lcid92" table="bklist" id="92" get="locid"/>
<lc id="@lcid92" V_hint="cruise"/>
<sleep time="3000"/>
<fn id="@lcid92" fndesc="Sound" fncmd="on"/>
</xmlscript>

Please note that the block does not trigger the event at all but the system uses the trains last location (block 92) to determine which train to apply the changes to.
This works not only for occupied blocks but also reserved or departing or crossing.


thank you, that was extremly helpful. i owe you one.

Fab

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2025, Yet Another Forum.NET
This page was generated in 0.359 seconds.