xmlscripting-en
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
xmlscripting-en [2018/11/12 08:56] – external edit 127.0.0.1 | xmlscripting-en [2019/05/12 10:18] – [clock] rjversluis | ||
---|---|---|---|
Line 16: | Line 16: | ||
XML scripting can be used in combination with __**[[: | XML scripting can be used in combination with __**[[: | ||
Its primary goal is to simplify and to reduce the number of actions and conditions.\\ | Its primary goal is to simplify and to reduce the number of actions and conditions.\\ | ||
- | The XML used for the scripting is the same as used in the __**[[http:// | + | The XML used for the scripting is the same as used in the __**[[https:// |
\\ | \\ | ||
Line 370: | Line 370: | ||
Instead of the subidx the subid can also be used if the sub node has an ID.\\ | Instead of the subidx the subid can also be used if the sub node has an ID.\\ | ||
+ | ===Function example=== | ||
+ | The loco ID, //locid//, is retrieved from block **cb4** in variable **lcid**.\\ | ||
+ | The function command requires a loco ID, which is provided by the text contents of the variable **@lcid**.\\ | ||
+ | <code xml> | ||
+ | < | ||
+ | <query vr=" | ||
+ | <fn id=" | ||
+ | </ | ||
+ | </ | ||
\\ | \\ | ||
====set==== | ====set==== | ||
Line 382: | Line 391: | ||
</ | </ | ||
Instead of the subidx the subid can also be used if the sub node has an ID.\\ | Instead of the subidx the subid can also be used if the sub node has an ID.\\ | ||
- | + | \\ | |
+ | ====clock==== | ||
+ | | 15401+ | | ||
+ | With the clock get command: | ||
+ | <code xml> | ||
+ | <clock cmd=" | ||
+ | </ | ||
+ | three variables will be updated. | ||
+ | ^ Variable name ^ Value ^ Text ^ | ||
+ | | modeltime | hour * 3600 + minute * 60 + seconds | hh:mm.ss | | ||
+ | | realtime | hour * 3600 + minute * 60 + seconds | hh:mm.ss | | ||
+ | | systemtick | count of 10ms since Rocrail server start | - | | ||
\\ | \\ | ||
Line 444: | Line 465: | ||
| System | sys | go, stop | | | | System | sys | go, stop | | | ||
| Automode | auto | on, off | | | | Automode | auto | on, off | | | ||
- | | Locomotive | lc | fwd, rev, +, -, min, mid, cruise, max, block, "// | + | | Locomotive | lc | fwd, rev, +, -, min, mid, cruise, max, block, "// |
| Car | car | empty, loaded, maintenance, | | Car | car | empty, loaded, maintenance, | ||
| Waybill | waybill | waiting, shipping, delivered, "// | | Waybill | waybill | waiting, shipping, delivered, "// | ||
Line 458: | Line 479: | ||
=====Commands===== | =====Commands===== | ||
Note: \\ | Note: \\ | ||
- | * With " | + | * With " |
* The special implemented action commands are listed separately. | * The special implemented action commands are listed separately. | ||
Line 464: | Line 485: | ||
\\ | \\ | ||
^ Object Name ^ Object type ^ Commands ^States ^ Remark ^ Example ^ | ^ Object Name ^ Object type ^ Commands ^States ^ Remark ^ Example ^ | ||
- | | Loco | lc | All http:// | + | | Loco | lc | All https:// |
| Function | fn | All and fndesc, fncmd | | The fnchanged or the fndesc, function description, | | Function | fn | All and fndesc, fncmd | | The fnchanged or the fndesc, function description, | ||
| Switch | sw | All | | | | Switch | sw | All | | | ||
Line 478: | Line 499: | ||
| Action control | actionctrl | | | The id in the actionctrl is a reference to an existing action. Condition child nodes may be added. | | | Action control | actionctrl | | | The id in the actionctrl is a reference to an existing action. Condition child nodes may be added. | | ||
| Operator | operator | emptycar, loadcar, addcar, leavecar | | In the carids attribute a list of cars must be specified. | | | Operator | operator | emptycar, loadcar, addcar, leavecar | | In the carids attribute a list of cars must be specified. | | ||
- | | System | sys | All http:// | + | | System | sys | All https:// |
- | | Automat | auto | All http:// | + | | Automat | auto | All https:// |
| Car | car | empty, loaded, maintenance, | | Car | car | empty, loaded, maintenance, | ||
- | | Staging block | sb | All http:// | + | | Staging block | sb | All https:// |
- | | Fiddle Yard | seltab | All http:// | + | | Fiddle Yard | seltab | All https:// |
- | | Location | location | All http:// | + | | Location | location | All https:// |
- | | Clock | clock | All http:// | + | | Clock | clock | All https:// |
- | | Turntable | tt | All http:// | + | | Turntable | tt | All https:// |
- | | External | ext | All http:// | + | | External | ext | All https:// |
| Weather | weather | setweather, weathertheme | | | | Weather | weather | setweather, weathertheme | | | ||
| Light | light | flip, enable, disable | Enable a light from LightControl. | | | Light | light | flip, enable, disable | Enable a light from LightControl. | | ||
- | | Model | model | All http:// | + | | Model | model | All https:// |
====Attribute values==== | ====Attribute values==== | ||
Line 520: | Line 541: | ||
\\ | \\ | ||
+ | =====Variable Format===== | ||
+ | With the format attribute it is possible to format variable content in the same way as printf.\\ | ||
+ | ====Example==== | ||
+ | <code xml> | ||
+ | < | ||
+ | <vr id=" | ||
+ | <vr id=" | ||
+ | <vr id=" | ||
+ | <trace text=" | ||
+ | </ | ||
+ | </ | ||
+ | Output __with__ the format attribute looks like: | ||
+ | < | ||
+ | Hello03: | ||
+ | </ | ||
+ | Output __without__ the format attribute looks like: | ||
+ | < | ||
+ | Hello 3 5 RocrailFans | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | \\ | ||
=====Tips===== | =====Tips===== | ||
====XML Well Formed==== | ====XML Well Formed==== |
xmlscripting-en.txt · Last modified: 2024/02/15 10:43 by rjversluis