How to Use Parent and Child Rules
m |
m (→Parent/Child Rule Example) |
||
(5 intermediate revisions by one user not shown) | |||
Line 125: | Line 125: | ||
<tr valign="top"> | <tr valign="top"> | ||
<td width=25>[[image:DotPoint1.JPG|link=]]</td> | <td width=25>[[image:DotPoint1.JPG|link=]]</td> | ||
− | <td>select (<span style="font-weight: 700; font-size: 15px; background-color: lightcyan;"> | + | <td>select (<span style="font-weight: 700; font-size: 15px; background-color: lightcyan;">Left Click</span>) the rule to be indented</td> |
</tr> | </tr> | ||
<tr valign="top"> | <tr valign="top"> | ||
Line 139: | Line 139: | ||
</table> | </table> | ||
==Parent/Child Rule Example== | ==Parent/Child Rule Example== | ||
− | + | In the following example, a '''Trigger Check Rule''' is acting as the ''switch'' that decides whether or not its child rules will be executed. If the Trigger is activated, for example by a particular train passing over its track trigger, then its child rules will be executed. Otherwise the '''Trigger Check Rule''' will wait indefinitely until that event occurs, or the session is terminated. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<table width=1000> | <table width=1000> | ||
<tr valign="top"> | <tr valign="top"> | ||
− | <td> | + | <td width=600>[[image:Message_Popup.jpg|600px|link=]]</td> |
− | <table> | + | <td> |
+ | <table bgcolor=#000000 cellpadding=2> | ||
<tr valign="top"> | <tr valign="top"> | ||
− | < | + | <td> |
− | + | <table bgcolor=#ffffff cellpadding=2> | |
− | <table> | + | |
<tr valign="top"> | <tr valign="top"> | ||
<td width=10>[[image:DotPoint.JPG|10px|link=]]</td> | <td width=10>[[image:DotPoint.JPG|10px|link=]]</td> | ||
− | <td> | + | <td>the cause of the trigger event is set in the properties of the '''Trigger Check Rule''' </td> |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</tr> | </tr> | ||
<tr valign="top"> | <tr valign="top"> | ||
<td>[[image:DotPoint.JPG|10px|link=]]</td> | <td>[[image:DotPoint.JPG|10px|link=]]</td> | ||
− | <td> | + | <td>the message shown is set in the properties of the '''Message Popup Rule''' </td> |
− | < | + | </tr> |
<tr valign="top"> | <tr valign="top"> | ||
<td>[[image:DotPoint.JPG|10px|link=]]</td> | <td>[[image:DotPoint.JPG|10px|link=]]</td> | ||
− | <td> | + | <td>the duration of the wait is set in the properties of the '''Wait Rule''' </td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 176: | Line 168: | ||
</tr> | </tr> | ||
</table> | </table> | ||
− | </td> | + | |
+ | <table width=1000> | ||
+ | <tr valign="top"> | ||
+ | <td>In the screenshot above, the | ||
+ | <table> | ||
+ | <tr valign="top"> | ||
+ | <td>'''Line''' <span style="font-weight: 700; font-size: 15px; color: white; background-color: black;"> 1 </span>''': Trigger Check Rule''' is a Parent Rule. It has rules indented below it which are its Child Rules:-</td> | ||
+ | </tr> | ||
+ | <tr valign="top"> | ||
+ | <td> | ||
+ | :'''Line''' <span style="font-weight: 700; font-size: 15px; color: white; background-color: black;"> 2 </span>''': Simultaneous List Rule''' is indented under the '''Trigger Check Rule''' so it is a Child of that rule. It is also a Parent Rule and it has its own Child Rules indented below it:-</td> | ||
+ | </tr> | ||
+ | <tr valign="top"> | ||
+ | <td> | ||
+ | ::'''Line''' <span style="font-weight: 700; font-size: 15px; color: white; background-color: black;"> 3 </span>''': Message Popup Rule''' is indented under the '''Simultaneous List Rule''' so it is a Child of that rule</td> | ||
+ | </tr> | ||
+ | <tr valign="top"> | ||
+ | <td> | ||
+ | ::'''Line''' <span style="font-weight: 700; font-size: 15px; color: white; background-color: black;"> 4 </span>''': Wait Rule''' is indented under the '''Simultaneous List Rule''' so it is a Child of that rule. It is also a Parent Rule as it has rules indented below it</td> | ||
+ | </tr> | ||
+ | <tr valign="top"> | ||
+ | <td> | ||
+ | :::'''Line''' <span style="font-weight: 700; font-size: 15px; color: white; background-color: black;"> 5 </span>''': Close Message Popup Rule''' is indented under the '''Wait Rule''' so it is a Child of that rule</td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 756: | Line 770: | ||
</tr> | </tr> | ||
</table> <!-- END Nav Buttons Table --> | </table> <!-- END Nav Buttons Table --> | ||
− | + | <br> | |
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<table> <!-- BEGIN Nav Buttons Table --> | <table> <!-- BEGIN Nav Buttons Table --> | ||
<tr valign="top"> | <tr valign="top"> | ||
Line 776: | Line 778: | ||
---- | ---- | ||
---- | ---- | ||
− | |||
='''Trainz Wiki'''= | ='''Trainz Wiki'''= | ||
− | <table | + | <table width=1000> |
<tr valign="top"> | <tr valign="top"> | ||
− | <td>[[image:TrainzWiki.png|link=]]</td> | + | <td> |
+ | <table width=500 cellpadding=2 bgcolor=#ffffff> | ||
+ | <tr valign="top"> | ||
+ | <td width=80>[[image:TrainzWiki.png|link=]]</td> | ||
<td> | <td> | ||
<span style="font-size: 17px;">'''More Tutorials and Guides to Using Trainz'''</span><br> | <span style="font-size: 17px;">'''More Tutorials and Guides to Using Trainz'''</span><br> | ||
− | *'''<span class=" | + | *'''<span class="plain;s">[http://online.ts2009.com/mediaWiki/index.php/HowTo How to Guides]</span>''' |
*'''[[Driver Commands List]]''' | *'''[[Driver Commands List]]''' | ||
*'''[[Session Rule List with Parameters|Session Rules List (Alphabetical) with Parameters]]''' | *'''[[Session Rule List with Parameters|Session Rules List (Alphabetical) with Parameters]]''' | ||
*'''[[Session Rules By Categories With Properties|Session Rules List (Categories) With Parameters]]''' | *'''[[Session Rules By Categories With Properties|Session Rules List (Categories) With Parameters]]''' | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | </td> | ||
+ | <td> | ||
+ | <table width=500 cellpadding=4 bgcolor="aquamarine"> | ||
+ | <tr valign="top"> | ||
+ | <td width=50>[[image:LinkWiki.PNG|link=]]</td> | ||
+ | <td> | ||
+ | <span style="font-size: 17px;">'''Related Links'''</span><br> | ||
+ | *'''[[How to Use Message Popup Rule|How to Use the Message Popup Rule]]''' | ||
+ | *'''[[How to Use Navigation Point Rules|How to Use Navigation Point Rules]]''' | ||
+ | *'''[[How to Use Session Editor|How to Use the Session Editor]]''' | ||
+ | *'''[[Parent and Child Rules|Parent and Child Rules]]''' | ||
+ | </td> | ||
+ | </tr> | ||
+ | </table> | ||
</td> | </td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
---- | ---- | ||
− | This page was created by Trainz user '''<span class=" | + | This page was created by Trainz user '''<span class="plain;s">[http://online.ts2009.com/mediaWiki/index.php/User:Pware pware]</span>''' in May 2018 and was last updated as shown below. |
---- | ---- | ||
[[Category:How-to guides]][[Category:Rules]] | [[Category:How-to guides]][[Category:Rules]] |
Latest revision as of 09:35, 1 August 2024
The information in this Wiki Page applies to TANE, TRS19, Trainz Plus and TRS22.
|
|
[edit] What Are Parent and Child Rules?
Rules that act as Parent Rules can have one or more sub-rules or Child Rules under them | |
Rules are edited and managed by the Session Editor in Surveyor |
More information on the Session Editor can be found on the Trainz Wiki Page at:- |
Most Parent Rules are used as "decision makers" in Trainz Sessions. They decide if or when other rules, the Child Rules, will be executed. Some Parent Rules control how those Child Rules are executed. |
|
Session rules can be arranged in a hierarchical fashion, in a series of levels as shown in the example on the left. A Parent Rule can be used to group together a set of rules at a lower level in the hierarchy. The rules that are grouped together under a Parent Rule are the Child Rules. Child Rules can also be Parent Rules that group together other rules at an even lower level. This creates multiple levels in the hierarchy. The Parent Rule at the head of each level in the hierarchy acts as a switch that directs the Trainz session to either ignore (skip over) or obey (execute) the Child Rules under its control. |
Rules that act as Child Rules are indented under a Parent Rule |
|
[edit] Parent/Child Rule Example
In the following example, a Trigger Check Rule is acting as the switch that decides whether or not its child rules will be executed. If the Trigger is activated, for example by a particular train passing over its track trigger, then its child rules will be executed. Otherwise the Trigger Check Rule will wait indefinitely until that event occurs, or the session is terminated.
|
In the screenshot above, the
|
Sequence of Events | ||||||||
When the consist identified in the Trigger Check Rule, a Parent Rule, reaches the set trigger, the Trigger Event is activated and its Child Rules are executed | ||||||||
The Simultaneous List Rule, a Parent Rule, is then executed. It executes all its Child Rules immediately and simultaneously | ||||||||
|
||||||||
The Close Message Popup Rule is executed. This closes the Message window created by the Message Popup Rule | ||||||||
Since the Close Message Popup Rule is the last child rule under the Wait Rule, when it has completed its task (closing the message popup) it will terminate the Wait Parent Rule | ||||||||
Since it is also the last child rule under the Simultaneous List Rule it will terminate that Parent Rule | ||||||||
Finally, since it is the last child rule under the Trigger Check Rule, it also terminates that Parent Rule |
[edit] Ordered Lists vs Simultaneous Lists
The majority of sibling Child Rules, rules that are at the same indent level under a Parent Rule, will be executed in order (an Ordered List) or simultaneously (a Simultaneous List). |
[edit] Ordered Lists
Details for this rule can be found at Ordered List Rule | |
Ordered Lists are shown with numbered icons on each Child Rule which indicates the order in which they will be executed |
|
|
Setting the Options
The rule settings allow you to control how many times an Ordered List will run.
|
[edit] Simultaneous Lists
Details for this rule can be found at Simultaneous List Rule | |
Simultaneous Lists are shown with equality (=) icons on each Child Rule which indicates that they will all be executed at the same time |
|
Setting the Options
The rule settings allow you to control how a Simultaneous List will be terminated.
|
|
|
[edit] Other Types of Lists
[edit] Progressive Lists
Details for this rule can be found at Progressive List Rule | |
Progressive Lists are shown with numbered icons on each Child Rule which indicates the progressive order in which they will be executed on each cycle of the list |
|
Setting the Options
The rule settings allow you to control what happens after the last child rule in a Progressive List has been completed.
|
|
[edit] Random Lists
Details for this rule can be found at Random List Rule | |
Random Lists are shown with "dot" icons on each Child Rule which indicates that ONE of them will be selected at random |
|
[edit] Reset Lists
Details for this rule can be found at Reset List Rule | |
Reset Lists are shown with equality (=) icons on each Child Rule which indicates that they will all be executed at the same time |
|
[edit] Trainz Wiki
|
|
This page was created by Trainz user pware in May 2018 and was last updated as shown below.