Routes with actions

ContentManual Mode



The raw Plan

First Plan with one turnout and two routes defined. The three buttons are to set the routes.

<plan title="plan.xml" rocguiversion="1.4.999 revision 924" rocrailversion="1.4.999 revision 924">
  <zlevel title="example" z="0" active="true"/>
  <tklist>
    <tk type="straight" id="tk20091025102741245" x="3" y="2" z="0"/>
    <tk type="straight" id="tk20091025102741717" x="4" y="2" z="0"/>
    <tk type="straight" id="tk20091025102801615" x="6" y="1" z="0"/>
    <tk type="straight" id="tk20091025102802741" x="7" y="1" z="0"/>
    <tk type="straight" id="tk20091025102803693" x="6" y="2" z="0"/>
    <tk type="straight" id="tk20091025102804102" x="7" y="2" z="0"/>
    <tk type="straight" id="tk20091025102808046" x="8" y="1" z="0"/>
    <tk type="straight" id="tk20091025102808510" x="8" y="2" z="0"/>
    <tk type="curve" id="tk20091025102842839" x="5" y="1" z="0" ori="north"/>
    <tk type="straight" id="tk20091025102848135" x="10" y="1" z="0"/>
    <tk type="straight" id="tk20091025102848975" x="10" y="2" z="0"/>
    <tk type="straight" id="tk20091025102850567" x="1" y="2" z="0"/>
  </tklist>
  <swlist>
    <sw type="left" id="w1" x="5" y="2" z="0" switched="9" ori="east" prev_id="w1" blockid="" accnr="1" savepos="none" dir="false" swtype="default" road="false" iid="" bus="0" addr1="0" port1="999" gate1="0" inv="false" singlegate="false" addr2="0" port2="0" inv2="false" actdelay="false" delay="0" prot="D" fbRinv="false" fbGinv="false" fb2Rinv="false" fb2Ginv="false" state="turnout">
      <accessoryctrl active="false" interval="0" delay="0" lockroutes=""/>
    </sw>
  </swlist>
  <colist>
    <co id="a1" x="9" y="1" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west"/>
    <co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west"/>
    <co id="a3" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off"/>
  </colist>
  <stlist>
    <st id="w_b1" prev_id="w_b1" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="straight" lock="true"/>
    </st>
    <st id="w_b2" prev_id="w_b2" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="turnout" lock="true"/>
    </st>
  </stlist>
</plan>

The Actions

now we need two actions to trigger the routes. This could be done using the actions Dialog.

in the plan.xml the following lines are added:

<aclist>
    <ac id="ac_b1" timed="false" hour="0" min="0" cmd="" oid="w_b1" actiontime="0" param="" timer="0" type="st"/>
    <ac id="ac_b2" timed="false" hour="0" min="0" cmd="" oid="w_b2" actiontime="0" param="" timer="0" type="st"/>
</aclist>

The Buttons

Now, what we want is that if one presses the start button and after that a button in one in the track the corresponding route is set. Therefore we need the condition that the action is executed if button 1 is on.

<co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west">
    <actionctrl id="ac_b1">
        <actioncond id="a1" state="on" type="co"/>
    </actionctrl>
</co>
<co id="a3" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
    <actionctrl id="ac_b2">
        <actioncond id="a1" state="on" type="co"/>
    </actionctrl>
</co>

but now the buttons stay on after the route is set. So we have to define another action to set them back to off.

So we expand the aclist to:

  <aclist>
    <ac id="ac_b1" timed="false" hour="0" min="0" cmd="" oid="w_b1" actiontime="0" param="" timer="0" type="st"/>
    <ac id="ac_b2" timed="false" hour="0" min="0" cmd="" oid="w_b2" actiontime="0" param="" timer="0" type="st"/>
    <ac id="a1_off" timed="false" hour="0" min="0" cmd="off" oid="a1" actiontime="0" param="" timer="0" type="co"/>
    <ac id="a2_off" timed="false" hour="0" min="0" cmd="off" oid="a2" actiontime="0" param="" timer="0" type="co"/>
    <ac id="aw_off" timed="false" hour="0" min="0" cmd="off" oid="aw" actiontime="0" param="" timer="0" type="co"/>
  </aclist>

and add the actions to the Buttons:

  <colist>
    <co id="a1" x="9" y="1" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b1">
        <actioncond id="aW" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
    <co id="aw" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off"/>
    <co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b2">
        <actioncond id="aW" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
  </colist>

The final planfile

looks like this:

<plan title="plan.xml" rocguiversion="1.4.999 revision 924" rocrailversion="1.4.999 revision 924">
  <zlevel title="example" z="0" active="true"/>
  <tklist>
    <tk type="straight" id="tk20091025102741245" x="3" y="2" z="0"/>
    <tk type="straight" id="tk20091025102741717" x="4" y="2" z="0"/>
    <tk type="straight" id="tk20091025102801615" x="6" y="1" z="0"/>
    <tk type="straight" id="tk20091025102802741" x="7" y="1" z="0"/>
    <tk type="straight" id="tk20091025102803693" x="6" y="2" z="0"/>
    <tk type="straight" id="tk20091025102804102" x="7" y="2" z="0"/>
    <tk type="straight" id="tk20091025102808046" x="8" y="1" z="0"/>
    <tk type="straight" id="tk20091025102808510" x="8" y="2" z="0"/>
    <tk type="curve" id="tk20091025102842839" x="5" y="1" z="0" ori="north"/>
    <tk type="straight" id="tk20091025102848135" x="10" y="1" z="0"/>
    <tk type="straight" id="tk20091025102848975" x="10" y="2" z="0"/>
    <tk type="straight" id="tk20091025102850567" x="1" y="2" z="0"/>
  </tklist>
  <swlist>
    <sw type="left" id="w1" x="5" y="2" z="0" switched="29" ori="east" prev_id="w1" blockid="" accnr="1" savepos="none" dir="false" swtype="default" road="false" iid="" bus="0" addr1="0" port1="999" gate1="0" inv="false" singlegate="false" addr2="0" port2="0" inv2="false" actdelay="false" delay="0" prot="D" fbRinv="false" fbGinv="false" fb2Rinv="false" fb2Ginv="false" state="turnout">
      <accessoryctrl active="false" interval="0" delay="0" lockroutes=""/>
    </sw>
  </swlist>
  <colist>
    <co id="a1" x="9" y="1" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b1">
        <actioncond id="aw" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
    <co id="aw" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off"/>
    <co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b2">
        <actioncond id="aw" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
  </colist>
  <stlist>
    <st id="w_b1" prev_id="w_b1" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="turnout" lock="true"/>
    </st>
    <st id="w_b2" prev_id="w_b2" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="straight" lock="true"/>
    </st>
  </stlist>
  <aclist>
    <ac id="ac_b1" timed="false" hour="0" min="0" cmd="" oid="w_b1" actiontime="0" param="" timer="0" type="st"/>
    <ac id="ac_b2" timed="false" hour="0" min="0" cmd="" oid="w_b2" actiontime="0" param="" timer="0" type="st"/>
    <ac id="a1_off" timed="false" hour="0" min="0" cmd="off" oid="a1" actiontime="0" param="" timer="0" type="co"/>
    <ac id="a2_off" timed="false" hour="0" min="0" cmd="off" oid="a2" actiontime="0" param="" timer="0" type="co"/>
    <ac id="aw_off" timed="false" hour="0" min="0" cmd="off" oid="aw" actiontime="0" param="" timer="0" type="co"/>
  </aclist>
</plan>

All of those can be done using the gui. But it's much easier to edit the xml files directly.


Personal Tools