Xml scripting for signals

Post Reply
Posts: 33
Joined: 13.02.2016, 08:04

Xml scripting for signals

Post by elibuj » 12.09.2019, 20:55


Id like to change aspect of multi aspect signal in xml scripting.

In the wiki https://wiki.rocrail.net/doku.php?id=actions-en
I read that some commands needs parameter. So I guess I have to use a cmd aspect with a parameter but doesnt know how to specify the parameter in xml

I try to do : <sg id="sg6" cmd="aspect" param="2"/>
But does not work.

Is it possible changing aspect in XML. What is the name for the param ?


Posts: 93
Joined: 05.12.2017, 11:08
Location: West Hertfordshire, UK

Re: Xml scripting for signals

Post by apemberton » 13.09.2019, 08:43

I have set up .xml scripts (many of them) to control my signals. They are not efficient programming but they work. What I am going to state below may have changed because Rocrail has had enhancements to its signal operations.

I am using Qdecoder DCC signal controllers which do not conform to the standard Rocrail layout and thus need specialist controls, for which I am using Outputs for the DCC commands - lots of them. I have not yet started using routes and blocks as all this is still in the experimental state. More fun to come!

Firstly, my signal interface tab is set to Linear, Accessory unchecked, Output selected. Because I cannot use the signal port and address, I set the address and port to a non-existent DCC port. The signal DCC command is sent but does nothing as no decoder sees it. I also set up the action field in the general tab for all the .xml scripts and the appropriate linear state. One state for each aspect.

Secondly, my details tab is just set for the number of aspects (in my worst case 14 Aspects) and as I'm using custom SVG signals, I have set a prefix relevant to the desired signal. All the addressing is set to N and the number and values are set to zero. That is because I don't need to send anything useful to DCC from the signal tab.

Third I set up an output for every required aspect with the correct address for the decoder. I create an Output command with the interface tab with the correct address for the decoder aspect I require. I have unchecked the Accessory box and selected the Output radio button.

Finally I created a script for every required aspect. There is a script for every aspect. Each Qdecoder aspect needs at least two DCC Commands to select the correct aspect. A typical script is:-

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
  <co id="SG1_Set_1_Red" cmd="on"/>
  <co id="SG1_Halt_Red" cmd="on"/>
to set signal to its red aspect.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
  <co id="SG1_Set_1_Green" cmd="on"/>
  <co id="SG1_Vmax_Green" cmd="on"/>
to set Green. All the id names refer to an individual Output command.

I do not need to send an 'off' output to clear a state.

My apologies for not being able to attach screenshots of my tabs as I'm away from my Rocrail systems.
Have fun, Tony

Post Reply

Return to “General”