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 Tue Albertsen  
#1 Posted : 21 February 2024 13:44:40(UTC)
Tue Albertsen

Denmark   
Joined: 27/04/2022(UTC)
Posts: 14
Location: Hovedstaden, Copenhagen
Hello

Everything is working excellent in my rocrail installation so now is a good time to start experimenting with xml scripting.

I will start simple and have a questions to this example:

<xmlscript>
<query vr="lcid" table="bklist" id="cb4" get="locid"/>
<fn id="@lcid" fnchanged="3" f3="true"/>
</xmlscript>

Why do I have to set "fnchanged" to "3". In all the examples I have seen, this value could be extracted from the following "f3" specification. So in other words; what is "f3" actually referring to?

Best Regards

Tue
Online JohnjeanB  
#2 Posted : 21 February 2024 15:50:40(UTC)
JohnjeanB

France   
Joined: 04/02/2011(UTC)
Posts: 3,137
Location: Paris, France
Hi Tue
Here a French Rocrail fan, still learning on XML
So you want to look into the Rocrail table named "bklist".
I am not sure what you are trying to do with it.

BKLIST CONTENT
Here is the simplest block record I have in my "PLAN"
<bk id="174" x="20" y="24" z="0" reserved="false" entering="false" managerid="" locid="VT_798_716" state="open" prev_id="174" desc="" len="350" offsetplus="0" offsetminus="0" departdelay="0" fifosize="0" randomrate="10" electrified="false" gomanual="true" acceptghost="false" acceptident="false" terminalstation="false" wait="true" road="false" allowchgdir="true" smallsymbol="true" extstop="false" allowbbt="false" bbtfix="0" mainline="false" sleeponclosed="false" freeblockonenter="false" allowaccessoncars="true" centertrain="false" commuter="yes" show="true" virtual="false" slaveblocks="" ttid="" signal="" wsignal="" signalR="" wsignalR="" statesignal="" blankatredsignal="false" openblocksignal="false" openblockid="" blankatredsignalR="false" openblocksignalR="false" openblockidR="" speed="cruise" exitspeed="cruise" stopspeed="mid" type="none" nonewaittype="" incline="0" waitmode="fixed" maxkmh="0" minwaittime="1" maxwaittime="30" waittime="1" mvscale="0" mvdistance="0" mvmph="false" evttimer="0" evttimer2="0" forceblocktimer="false" selectshortestblock="false" iid="" addr="0" port="0" td="false" tdV0="false" tdlinkblocks="false" typeperm="" class="" era="0" ori="north" masterid="" controlcode="" slavecode="" server="infw08D9735C" freeblockonenterplus="true" freeblockonentermin="true" secondnextblock4wait="false" mvrecord="false" polarisation="true" rearprotection="false" fifogap="0" codesen="" platform="" freeblockonenterroute="true" fifoids="" shunting="false" embeddedfbplus="false" embeddedfbmin="false" lenenter2in="0" radius="0" freeblockonentermaxlen="0" resetsignalonexit="false" noreduceonexit="false" waitside="0" reservedevents="false" prevlocId="VT_798_716" cleanstamp="0">
<fbevent id="fa174" action="enter2in" from="all" byroute="all" endpuls="false" use_timer2="false"/>
<fbevent id="fa174" action="enter2in" from="all-reverse" byroute="all-reverse" endpuls="false" use_timer2="false"/>
</bk>

It contains many elementary records: bk id is the name, the location in the plan x and y coordinates and the z represent the level (I have only one level) and so more variables such as which loco occupies it (locoid="VT_798_716"), is it an electrified section (electrified="false") so it is not, etc etc.

So now, How to create an XML program to read the table?
To answer this question I will use a sample program I did to explore another table called lklist Its location depends on your Rocrail configuration and for me it is in a file called locofile



The sample program I wrote explores the table and extract the following information:
- where is each loco? (In which block)
- so the answer can be "not found" then the loco is not on the layout
- it is in a block and depending which one, it is either "en route" or in a strorage track (a branch line, a shed track
- depending on the location, the headlight are turned on or off and so is the sound
- a further search is about decoders that are not for locos (fonction cars) so they may require a special configuration
- it prints the results on a trace in the left lower quadrant of rocrail
- you may adapt it for you by updating the pathnames of files and the lisy of blocks

Sample program
0 AK Licht on V4.zip (2kb) downloaded 14 time(s).

and to help you better understand what it reads, here is an extract of my locofile (only the 3 dirst locos
<plan>
<lclist>
<lc id="NS_2400" prev_id="NS_2400" desc="" remark="" len="0" catnr="" purchased="" runtime="363126" identifier="0" bus="0" addr="23" iid="MyMCS2" prot="M" protver="1" spcnt="128" fncnt="4" V_min="10" V_mid="50" V_max="100" V_Rmin="0" V_Rmid="0" V_Rmax="0" V_step="0" mass="0" V_mode="percent" placing="false" regulated="true" dirpause="0" dirchgspd="false" blockwaittime="10" evttimer="0" usescheduletime="false" commuter="false" trysamedir="false" tryoppositedir="false" engine="diesel" cargo="none" fn="true" consist="" image="3013.png" mode="stop" dir="true" V="0" resumeauto="false" blockid="" scidx="-1" destblockid="" V_hint="mid" show="true" secondnextblock="false" consist_lightsoff="false" fifotop="false" fx="0" prev_x="-1" prev_y="-1" prev_ori="west" shortid="" roadname="" number="" dectype="" docu="" imagenr="0" nrcars="0" value="" useshortid="false" mint="0" throttlenr="0" manually="false" secaddr="0" secspcnt="14" V_cru="80" V_maxsec="14" V_Rcru="0" restorefx="false" restorespeed="false" info4throttle="false" adjustaccel="false" maxload="0" accelmin="0" accelmax="0" maxwaittime="0" swaptimer="0" ent2incorr="100" priority="10" shortin="false" inatpre2in="false" usemanualroutes="false" useownwaittime="false" startupscid="" startuptourid="" check2in="false" usedepartdelay="true" freeblockonenter="false" v0onswap="false" era="0" class="" consist_syncfunmap="0" consist_syncfun="false" consist_synclights="false" usebbt="false" bbtsteps="10" bbtstartinterval="10" bbtmaxdiff="250" bbtcorrection="25" bbtusefromblock="false" restorefxalways="false" decelerate="0" reducespeedatenter="false" resetplacing="false" bbtkey="0" cmdDelay="0" Vmidpercent="30" Vmaxmin="20" Vmaxmax="255" Vmaxkmh="0" lookupschedulevirtual="false" trainlen="0" trainweight="0" rdate="1683125991" energypercentage="0" blockenterside="false" blockenterid="" modereason="" manual="false" mtime="0" active="true" waittime="0" scheduleid="" tourid="" train="" V_realkmh="0" lookupschedule="false" owner="" color="" home="" decfile="nmra-rp922.xml" weight="0" manuid="" oid="" KMH_min="0" KMH_mid="0" KMH_cru="0" KMH_max="0" KMH_Rmin="0" KMH_Rmid="0" KMH_Rcru="0" KMH_Rmax="0" Vmidset="true" minenergypercentage="0" routespeedatenter="false" generated="false" secondnextblock4wait="false" cvnrs="1,2,3,4,5,6,17,18,29" cmd="modify" signalaspect="" pause="false" uid="0" sid="0" shunting="false" standalone="false" scheduleinithour="0" screcord="false" throttleid="" modeevent="false" radius="0" nraxis="0" informall="false" KMH_Smin="0" KMH_Smid="0" KMH_Scru="0" KMH_Smax="0" V_Smin="0" V_Smid="0" V_Scru="0" V_Smax="0" minstep="0" maxstep="0" pwm="0" pwmcorrdiv="10" invdir="false" polarisation="true" accelcv="3" accelcvindex="0" vmaxcv="5" vmaxcvindex="0" vmidcv="6" vmidcvindex="0" camhost="" camport="8081" camtype="0" camfile="stream.mjpg" camskip="0" camoption="0" swapondir="false" decoupler="false" maxincline="0"/>
<lc id="VT_11.5" prev_id="VT_11.5" shortid="" roadname="DB" number="" desc="" dectype="" docu="" image="VT 11-5.png" imagenr="0" remark="" len="1509" nrcars="0" catnr="37605" purchased="2003" identifier="" show="true" useshortid="false" mint="40" throttlenr="0" bus="0" addr="70" iid="MyMCS2" prot="M" protver="1" spcnt="14" fncnt="4" V_min="12" V_mid="14" V_cru="85" V_max="90" V_Rmin="0" V_Rmid="0" V_Rcru="0" V_Rmax="0" V_step="0" mass="0" V_mode="percent" placing="true" regulated="true" restorefx="true" restorespeed="false" info4throttle="false" dirpause="0" adjustaccel="false" maxload="0" accelmin="0" accelmax="0" blockwaittime="2" evttimer="0" swaptimer="0" ent2incorr="100" priority="10" usescheduletime="false" commuter="false" shortin="false" inatpre2in="false" usemanualroutes="false" useownwaittime="false" startupscid="" startuptourid="" check2in="false" usedepartdelay="true" engine="diesel" cargo="none" secondnextblock="false" era="2" consist_syncfunmap="0" consist_lightsoff="false" consist_syncfun="false" consist="" usebbt="false" bbtsteps="10" bbtstartinterval="10" bbtmaxdiff="250" bbtcorrection="25" bbtusefromblock="true" V="0" fx="3" fn="true" runtime="292969" dir="true" server="infw10186E04" blockenterside="false" mode="stop" resumeauto="false" manual="false" mtime="195763" active="true" scidx="-1" scheduleid="" train="" trainlen="1509" cmd="modify" V_realkmh="0" blockid="113" V_hint="cruise" destblockid="" V_maxkmh="0" prev_x="-1" prev_y="-1" prev_ori="west" trainweight="0" fifotop="false" secaddr="0" tourid="" value="" manually="false" secspcnt="14" V_maxsec="14" maxwaittime="180" freeblockonenter="false" v0onswap="false" class="" consist_synclights="false" modereason="" restorefxalways="false" decelerate="0" reducespeedatenter="false" bbtkey="0" blockenterid="" resetplacing="false" cmdDelay="0" Vmidpercent="30" Vmaxmin="20" Vmaxmax="255" Vmaxkmh="0" lookupschedulevirtual="false" waittime="18" home="" KMH_min="0" KMH_mid="0" KMH_cru="0" KMH_max="0" KMH_Rmin="0" KMH_Rmid="0" KMH_Rcru="0" KMH_Rmax="0" Vmidset="true" lookupschedule="false" rdate="1708013313" energypercentage="0" owner="" color="" decfile="nmra-rp922.xml" minenergypercentage="0" routespeedatenter="false" secondnextblock4wait="false" cvnrs="1,2,3,4,5,6,17,18,29" signalaspect="" mdate="1524302690" weight="0" manuid="" oid="" generated="false" scheduleinithour="0" nraxis="0" pause="false" uid="0" sid="0" shunting="false" standalone="false" radius="0" informall="false" KMH_Smin="0" KMH_Smid="0" KMH_Scru="0" KMH_Smax="0" V_Smin="0" V_Smid="0" V_Scru="0" V_Smax="0" polarisation="true" accelcv="3" accelcvindex="0" vmaxcv="5" vmaxcvindex="0" vmidcv="6" vmidcvindex="0" camhost="" camport="8081" swapondir="false" invdir="false" camtype="0" camfile="stream.mjpg" camskip="0" screcord="false" modeevent="true" minstep="0" maxstep="0" pwm="0" throttleid="" pwmcorrdiv="10" camoption="0" decoupler="false" controlcode="" slavecode="" gotoblockid="" arrivetime="1706970873" modeblock="113" actor="user" wheeldiameter="13.000000" wheelbase="0" maxincline="0" sernr="" coupler="" forcepriority="false" commuterblocks="" waitallblocks="false" waitallblocksalt="false" routestack="false" stoponfailgoto="false" directgoto="false" engineFxType="" engineFxNr="0" sbt_decelerate="0" sbt_interval="0" bat_accelerate="0" bat_interval="0">
<fundef fn="1" text="Sound" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="2" text="Innenlichr" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="3" text="Horn" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="4" text="Last" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="0" text="Licht" timer="0" icon="" iconnr="0"/>
</lc>
<lc id="BR_50_981" prev_id="BR_50_981" shortid="" roadname="DB" number="29640A" desc="" dectype="" docu="" image="BR 50 TK Vf.png" imagenr="0" remark="" len="263" nrcars="0" catnr="29640" purchased="" identifier="" show="true" useshortid="false" mint="40" throttlenr="0" bus="0" addr="19" iid="MyMCS2" prot="F" protver="1" spcnt="126" fncnt="10" V_min="35" V_mid="39" V_cru="80" V_max="80" V_Rmin="10" V_Rmid="30" V_Rcru="80" V_Rmax="80" V_step="0" mass="0" V_mode="percent" placing="true" regulated="true" restorefx="true" restorespeed="false" info4throttle="false" dirpause="0" adjustaccel="false" maxload="0" accelmin="0" accelmax="0" blockwaittime="2" evttimer="0" swaptimer="0" ent2incorr="100" priority="10" usescheduletime="false" commuter="false" shortin="false" inatpre2in="false" usemanualroutes="false" useownwaittime="false" startupscid="" startuptourid="" check2in="false" usedepartdelay="true" engine="steam" cargo="none" secondnextblock="false" era="2" consist_syncfunmap="0" consist_lightsoff="false" consist_syncfun="false" consist="" usebbt="false" bbtsteps="10" bbtstartinterval="10" bbtmaxdiff="250" bbtcorrection="25" bbtusefromblock="true" V="0" fx="8194" fn="true" runtime="386483" dir="true" server="infw133230C4" blockenterside="false" mode="stop" resumeauto="false" manual="false" mtime="372764" active="true" scidx="-1" scheduleid="" train="BR 50 zug" trainlen="1255" blockid="146" V_hint="mid" V_realkmh="0" destblockid="" V_maxkmh="0" cmd="velocity" prev_x="-1" prev_y="-1" prev_ori="west" fifotop="false" secaddr="0" tourid="" trainweight="0" value="" manually="false" secspcnt="14" V_maxsec="14" maxwaittime="180" freeblockonenter="false" v0onswap="false" class="" consist_synclights="false" modereason="" restorefxalways="false" decelerate="0" reducespeedatenter="false" bbtkey="0" blockenterid="" cmdDelay="0" Vmidpercent="30" Vmaxmin="20" Vmaxmax="255" Vmaxkmh="0" resetplacing="false" lookupschedulevirtual="false" waittime="0" home="" KMH_min="0" KMH_mid="0" KMH_cru="0" KMH_max="0" KMH_Rmin="0" KMH_Rmid="0" KMH_Rcru="0" KMH_Rmax="0" Vmidset="true" lookupschedule="false" controlcode="" slavecode="" rdate="1706974079" routespeedatenter="false" energypercentage="0" mdate="1682260244" owner="" color="" decfile="nmra-rp922.xml" minenergypercentage="0" secondnextblock4wait="false" cvnrs="1,2,3,4,5,6,17,18,29" signalaspect="" weight="0" manuid="" oid="" generated="false" scheduleinithour="0" nraxis="0" pause="false" uid="0" sid="0" shunting="false" standalone="false" radius="0" informall="false" KMH_Smin="0" KMH_Smid="0" KMH_Scru="0" KMH_Smax="0" V_Smin="0" V_Smid="0" V_Scru="0" V_Smax="0" invdir="false" polarisation="true" accelcv="3" accelcvindex="0" vmaxcv="5" vmaxcvindex="0" vmidcv="6" vmidcvindex="0" camhost="" camport="8081" camtype="0" camfile="stream.mjpg" camskip="0" swapondir="false" minstep="0" maxstep="0" screcord="false" modeevent="false" throttleid="" pwm="0" pwmcorrdiv="10" camoption="0" decoupler="false" gotoblockid="" arrivetime="1706974535" modeblock="146" wheeldiameter="13.000000" wheelbase="0" maxincline="0" forcepriority="false" waitallblocks="false" waitallblocksalt="false" routestack="false" sbt_decelerate="0" sbt_interval="0" bat_accelerate="0" bat_interval="0" actor="user">
<fundef fn="0" text="Licht" timer="0" icon="" iconnr="0"/>
<fundef fn="1" text="Dampf" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="2" text="Sound" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="3" text="Pfeife" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="4" text="Last" sound="" icon="" timer="0" addr="0" mappedfn="0" iconnr="0" pushbutton="false" onpos="0" offpos="0" ledaddr="0" ledcount="0" ledbrightness="100"/>
<fundef fn="5" text="Bremse Lärm" sound="" icon="" timer="0" addr="0" mappedfn="0"/>
<fundef fn="6" text="Telex" sound="" icon="" timer="0" addr="0" mappedfn="0"/>
<fundef fn="7" text="Rangier Pfeife" sound="" icon="" timer="0" addr="0" mappedfn="0"/>
<fundef fn="8" text="Kohle Schaufln" sound="" icon="" timer="0" addr="0" mappedfn="0"/>
<fundef fn="10" text="F10 Sound" iconnr="5" pushbutton="false" code="10759"/>
</lc>


I hope all this helps
Note: it is not ass complicated as it looks
Cheers
Jean
thanks 1 user liked this useful post by JohnjeanB
Offline Tue Albertsen  
#3 Posted : 21 February 2024 16:49:43(UTC)
Tue Albertsen

Denmark   
Joined: 27/04/2022(UTC)
Posts: 14
Location: Hovedstaden, Copenhagen
Thanks for reply Jean - You have helped me several times before.
My question is more about why the "fn" function take these tree arguments.

Lets say i want to turn on the light on a loco in block cb4, and the light function is on f1 for this loco:
I guess the xml script would look like:

<xmlscript>
<query vr="lcid" table="bklist" id="cb4" get="locid"/>
<fn id="@lcid" fnchanged="1" f1="true"/>
</xmlscript>

I can understand why i have to specify "f1=true" but not "fnchanged=1". Does it have to do with the fact that you can reprogram the f1 button in rocrail to trigger another index than "1"?
:-) Tue

p.s.: when i try to open the "light" script you refer to, it just says:
This page contains the following errors:
error on line 22 at column 26: AttValude: " or " expected
Below is a rendering of the page up to the first error.
Offline Martti Mäntylä  
#4 Posted : 21 February 2024 16:49:58(UTC)
Martti Mäntylä

Finland   
Joined: 15/11/2018(UTC)
Posts: 398
Location: Uusimaa, Helsinki
Hi Tue,

I don't quite understand this either, but looking at https://wiki.rocrail.net/rocrail...crail/wrapper-en.html#fn reveals that attributes "f0" ... "f32" are booleans whereas "fnchanged" is an integer, perhaps used for indexing. One would need to look at the actual code of Rocrail so see why this approach is convenient.
- Martti M.
Era III analog & digital (Rocrail, CAN Digital Bahn, Gleisbox/MS2, K83/K84), C & M tracks, some Spur 1
thanks 1 user liked this useful post by Martti Mäntylä
Offline Tue Albertsen  
#5 Posted : 21 February 2024 19:26:45(UTC)
Tue Albertsen

Denmark   
Joined: 27/04/2022(UTC)
Posts: 14
Location: Hovedstaden, Copenhagen
Problem more or less solved :-)

See small example below:

The "f7="true" part of the "fn" command controls if a red dot is shown on the "f7" button (as activated) on the function button display left of the rocrail clock. If activated, it also prevents a reactivation of the function until deactivated (=no red dot).

In my small example, the script activates the horn (on f7) when the "in" sensor is reached in my block bk19 - and had to add a new lines to deactivate the "f7" button again - otherwise it only worked the first time:

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>
<query vr="lcid" table="bklist" id="bk19" get="locid"/>
<fn id="@lcid" fnchanged="7" f7="true"/>
<fn id="@lcid" fnchanged="7" f7="false"/>
</xmlscript>

Thanks for all your comments and good advices...

:-) Tue
thanks 1 user liked this useful post by Tue Albertsen
Online JohnjeanB  
#6 Posted : 21 February 2024 20:14:54(UTC)
JohnjeanB

France   
Joined: 04/02/2011(UTC)
Posts: 3,137
Location: Paris, France
Originally Posted by: Tue Albertsen Go to Quoted Post
Thanks for reply Jean - You have helped me several times before.
My question is more about why the "fn" function take these tree arguments.

Lets say i want to turn on the light on a loco in block cb4, and the light function is on f1 for this loco:
I guess the xml script would look like:

<xmlscript>
<query vr="lcid" table="bklist" id="cb4" get="locid"/>
<fn id="@lcid" fnchanged="1" f1="true"/>
</xmlscript>

I can understand why i have to specify "f1=true" but not "fnchanged=1". Does it have to do with the fact that you can reprogram the f1 button in rocrail to trigger another index than "1"?
:-) Tue

p.s.: when i try to open the "light" script you refer to, it just says:
This page contains the following errors:
error on line 22 at column 26: AttValude: " or " expected
Below is a rendering of the page up to the first error.

Hi Tue
I think you may get things very complicated.
- to turn ON or OFF a fonction on a loco, you need only an ACTION.
Here is an example to turn a fonction (F0)
Sans titre.png
The field Kennung is left blank or include the loco's name

In a XML program, to furn the fonction of a loco you will write
<fn id="BR_01_138" fnchanged="3" f3="true"/>
- Where BR_01_138 is the loco's name
- Where fnchanged="3" f3="true" means that fonction 3 of that loco is activated

In XML, the query fonction is to READ a variable (in a Rocrail table)
Example
<foreach table="lclist" >
<query vr="vr_SBFLZtmp" table="lclist" id="%oid%" get="blockid"/>
<query vr="vr_engine" table="lclist" id="%oid%" get="engine"/>

- where the table being red is lclist (list of locos in Rocrail
- where <query vr="vr_SBFLZtmp" table="lclist" id="%oid%" get="blockid"/> extracts blockid (in which block is the block where the loco in question is located and %oid% is the variable to point on a specific element ofg the table
- Where <query vr="vr_engine" table="lclist" id="%oid%" get="engine"/> extract the engine type of the loco (steam, diesel or electric

Cheers
Jean
thanks 1 user liked this useful post by JohnjeanB
Offline Tue Albertsen  
#7 Posted : 21 February 2024 22:35:47(UTC)
Tue Albertsen

Denmark   
Joined: 27/04/2022(UTC)
Posts: 14
Location: Hovedstaden, Copenhagen
Hi Jean
Guess you are right about me and doing this more complicated than necessary.
Anyway - as an old programmer - I like to know the syntactic and semantics meaning of the function calls, and this one puzzled me...

The whole idea is to start using xml scripts for some automatic shunting actions following this overall concept:
1) Detect a specific loco reaching an "in" sensor in a block.
2) Reverse throttle on loco and continue until "in" sensor is off.
3) Using telex couplers - uncouple loco and move it away.
4) Next time the loco arrives (with another car), it will push to the existing car and when block "on" sensor is reached, it will again reverse and uncouple - leaving two cars on the track - to be picked up later.

Do you think this will work?

Best regards
Tue
Online JohnjeanB  
#8 Posted : 22 February 2024 09:44:26(UTC)
JohnjeanB

France   
Joined: 04/02/2011(UTC)
Posts: 3,137
Location: Paris, France
Hi Tue
Of course it will work as it works for me
Here is a sample programme activated from a block when the IN condition is reached and when a specific loco is there (there is a CONDITION loco xx is there).
- Then Rocrail's order to stop (at the IN) is contradicted by an order to continue at a slow speed until another sensor is reached
- then the loco is stopped (it was in go, in aquarium mode).
- then the loco is reversed and stops when the extra sensor is free again
- then the uncoupler is activated and the loco is stopped
- then the loco is set in the same direction Rocrail left it
- and last a schedule is invoked so that a schedule takes over and leads the loco to the turntable

Here is a video of the action


and below is the xml programme (specific to each loco (because speed, length are specific to it)
Cheers
Jean

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>

<!------------------->
<!---Program Start -->
<!------------------->

<!---Lok bis fc98 vorwaerts langsam -->
<lc id="241_A_65_SNCF" V="45" dir="true"/>
<sleep time="400"/>
<!---Lok ohne last -->
<fn id="241_A_65_SNCF" fnchanged="4" f4="true"/>

<!---Warten bis fc98 besetzt ist -->
<while state="fb fc98 = off" max="200">
<lc id="241_A_65_SNCF" V="45" dir="true"/>
<sleep time="50"/>
</while>
<sleep time="10"/>

<!---Lok Halten -->
<lc id="241_A_65_SNCF" V="0"/>

<!---Loc in Manualmodus -->
<lc id="241_A_65_SNCF" cmd="stop"/>
<sleep time="1000"/>

<lc id="241_A_65_SNCF" cmd="swap"/>

<!---Entkuppeln versuch #1 -->
<sw id="98EK" cmd="straight"/>
<sleep time="350"/>

<!---Entkuppeln versuch #2 -->
<sw id="98EK" cmd="straight"/>

<!---Lok Halten -->
<lc id="241_A_65_SNCF" V="0"/>
<!---Lok ohne Last -->
<fn id="241_A_65_SNCF" fnchanged="4" f4="true"/>

<sleep time="500"/>
<!---Zug verlassen -->
<lc id="241_A_65_SNCF" cmd="releasetrain"/>

<lc id="241_A_65_SNCF" cmd="swap"/>

<!---Lok mit Last -->
<fn id="241_A_65_SNCF" fnchanged="4" f4="false"/>

<actionctrl id="Start Lok swap 98 Ank.Phase 1" cmd="on"/>
<sleep time="200"/>
<actionctrl id="Start Lok swap 98 Ank.Phase 1" cmd="off"/>

</xmlscript>



thanks 1 user liked this useful post by JohnjeanB
Offline Tue Albertsen  
#9 Posted : 22 February 2024 14:41:23(UTC)
Tue Albertsen

Denmark   
Joined: 27/04/2022(UTC)
Posts: 14
Location: Hovedstaden, Copenhagen
Thanks Jean
I will study your script and share my experience.
:-) Tue
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-2024, Yet Another Forum.NET
This page was generated in 0.770 seconds.