How to Use Parent and Child Rules

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
Line 3: Line 3:
 
Most '''Parent Rules''' are used as "decision makers" in TANE Sessions. They decide if or when other rules, the '''Child Rules''', will be executed. Some '''Parent Rules''' control how those '''Child Rules''' are executed.
 
Most '''Parent Rules''' are used as "decision makers" in TANE Sessions. They decide if or when other rules, the '''Child Rules''', will be executed. Some '''Parent Rules''' control how those '''Child Rules''' are executed.
  
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top>
 
<tr valign="top>
Line 10: Line 9:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
 
*Only certain rules can be Parent Rules. See the Trainz Wiki page '''[[Parent Rule List|List of Parent Rules]]''' for details.
 
*Only certain rules can be Parent Rules. See the Trainz Wiki page '''[[Parent Rule List|List of Parent Rules]]''' for details.
 
*Most Parent Rules will ''either'' wait for a specific event or perform a test or a comparison. They will execute the child rules when the event occurs or the test/comparison is ''true''.
 
*Most Parent Rules will ''either'' wait for a specific event or perform a test or a comparison. They will execute the child rules when the event occurs or the test/comparison is ''true''.
 
<br>
 
<br>
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top>
 
<tr valign="top>
Line 21: Line 18:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
  
 
*To '''indent''' a rule, highlight (select) it and click the '''Right Arrow ''Indent''''' tool at the bottom of the Session Editor.
 
*To '''indent''' a rule, highlight (select) it and click the '''Right Arrow ''Indent''''' tool at the bottom of the Session Editor.
Line 45: Line 41:
 
***'''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
 
***'''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
 
****'''Close Message Popup Rule''' is indented under the '''Wait Rule''' so it is a Child of that rule.  
 
****'''Close Message Popup Rule''' is indented under the '''Wait Rule''' so it is a Child of that rule.  
 
You can think of this as a family tree.
 
 
<table border=1>
 
<tr>
 
<td valign="top">'''Trigger Check Rule'''</td>
 
<td>
 
*Parent of '''Simultaneous List Rule'''
 
*Grand Parent of '''Message Popup Rule'''
 
*Grand Parent of '''Wait Rule'''
 
*Great Grand Parent of '''Close Message Popup Rule'''
 
</td>
 
</tr>
 
<tr>
 
<td valign="top">'''Simultaneous Check Rule'''</td>
 
<td>
 
*Child of '''Trigger Check Rule'''
 
*Parent of''' Message Popup Rule'''
 
*Parent of '''Wait Rule'''
 
*Grand Parent of '''Close Message Popup Rule'''
 
</td>
 
</tr>
 
<tr>
 
<td valign="top">'''Message Popup Rule'''</td>
 
<td>
 
*Grand Child of '''Trigger Check Rule'''
 
*Child of '''Simultaneous List Rule'''
 
*Sibling of '''Wait Rule'''
 
</td>
 
</tr>
 
<tr>
 
<td valign="top">'''Wait Rule'''</td>
 
<td>
 
*Grand Child of '''Trigger Check Rule'''
 
*Child of '''Simultaneous List Rule'''
 
*Sibling of '''Message Popup Rule'''
 
*Parent of '''Close Message Popup Rule'''
 
</td>
 
</tr>
 
<tr>
 
<td valign="top">'''Close Message Popup Rule'''</td>
 
<td>
 
*Great Grand Child of '''Trigger Check Rule'''
 
*Grand Child of '''Simultaneous Rule'''
 
*Child of '''Wait Rule'''
 
</td>
 
</tr>
 
</table>
 
  
 
==Sequence of Events==
 
==Sequence of Events==
Line 108: Line 56:
 
==Ordered Lists==
 
==Ordered Lists==
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Ordered_List_Rule|Ordered List Rule]]'''
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Ordered_List_Rule|Ordered List Rule]]'''
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top">
 
<tr valign="top">
Line 115: Line 62:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
  
 
<table>
 
<table>
Line 123: Line 69:
 
</table>
 
</table>
  
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top">
 
<tr valign="top">
Line 130: Line 75:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
 
*Because some rules will wait for an event (such as a mouse click, timer, consist trigger, load trigger, etc) before they are completed, it is possible for the Ordered List to ''hang'' indefinitely waiting for the event.
 
*Because some rules will wait for an event (such as a mouse click, timer, consist trigger, load trigger, etc) before they are completed, it is possible for the Ordered List to ''hang'' indefinitely waiting for the event.
 
*An Ordered List is completed when the last Child Rule is completed.
 
*An Ordered List is completed when the last Child Rule is completed.
Line 137: Line 81:
 
==Simultaneous Lists==
 
==Simultaneous Lists==
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Simultaneous_List_Rule|Simultaneous List Rule]]'''
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Simultaneous_List_Rule|Simultaneous List Rule]]'''
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top">
 
<tr valign="top">
Line 144: Line 87:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
  
 
<table>
 
<table>
Line 160: Line 102:
 
==Progressive Lists==
 
==Progressive Lists==
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Progressive_List_Rule|Progressive List Rule]]'''
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Progressive_List_Rule|Progressive List Rule]]'''
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top">
 
<tr valign="top">
Line 167: Line 108:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
  
 
<table>
 
<table>
Line 181: Line 121:
 
==Random Lists==
 
==Random Lists==
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Random_List_Rule|Random List Rule]]'''
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Random_List_Rule|Random List Rule]]'''
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top">
 
<tr valign="top">
Line 188: Line 127:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
  
 
<table>
 
<table>
Line 198: Line 136:
 
==Reset Lists==
 
==Reset Lists==
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Reset_List_Rule|Reset List Rule]]'''
 
'''Rule details can be found at [[Session_Rule_List_with_Parameters#Reset_List_Rule|Reset List Rule]]'''
----
 
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<table cellpadding="4" bgcolor=#c1e7e7>
 
<tr valign="top">
 
<tr valign="top">
Line 205: Line 142:
 
</tr>
 
</tr>
 
</table>
 
</table>
----
 
  
 
<table>
 
<table>

Revision as of 09:26, 28 June 2018

Contents

What Are Parent and Child Rules?

Most Parent Rules are used as "decision makers" in TANE Sessions. They decide if or when other rules, the Child Rules, will be executed. Some Parent Rules control how those Child Rules are executed.

DotPoint.JPG Rules that act as Parent Rules can have one or more sub-rules or Child Rules indented under them.
  • Only certain rules can be Parent Rules. See the Trainz Wiki page List of Parent Rules for details.
  • Most Parent Rules will either wait for a specific event or perform a test or a comparison. They will execute the child rules when the event occurs or the test/comparison is true.


DotPoint.JPG Rules that act as Child Rules are indented under a Parent Rule.
  • To indent a rule, highlight (select) it and click the Right Arrow Indent tool at the bottom of the Session Editor.
SessionRuleIndent.JPG SessionRuleIndented.JPG
  • Any rule can be a Child Rule.

Example

Message Popup.jpg

In the screenshot above, the

  • Trigger Check Rule is a Parent Rule. It has rules indented below it.
    • Simultaneous List Rule is indented under the Trigger Check Rule so it is a Child of that rule. It is also a Parent Rule as it has rules indented below it
      • Message Popup Rule is indented under the Simultaneous List Rule so it is a Child of that rule.
      • 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
        • Close Message Popup Rule is indented under the Wait Rule so it is a Child of that rule.

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 Message Popup Rule is executed. This waits until its message window is closed. At the same time ...
      • The Wait Rule is executed. This is set to force a 20 second wait, after which its Child Rule ...
        • The Close Message Popup Rule is executed. This closes the Message window created by the Message Popup Rule. Since it is the last rule under the Simultaneous List Rule it terminates that Parent Rule. Since it is the last rule under the Trigger Check Rule, it also terminates that Parent Rule.


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).

Ordered Lists

Rule details can be found at Ordered List Rule

DotPoint.JPG Ordered Lists are shown with numbered icons on each Child Rule which indicates the order in which they will be executed.
OrderedListRule.JPG
DotPoint.JPG Each Child Rule in the sequence must be completed before the next Child Rule can be executed.
  • Because some rules will wait for an event (such as a mouse click, timer, consist trigger, load trigger, etc) before they are completed, it is possible for the Ordered List to hang indefinitely waiting for the event.
  • An Ordered List is completed when the last Child Rule is completed.
  • If possible, place Child Rules that are event dependent at the end of an ordered list.

Simultaneous Lists

Rule details can be found at Simultaneous List Rule

DotPoint.JPG Simultaneous Lists are shown with equality ("=") icons on each Child Rule which indicates that they will be executed at the same time.
SimultaneousListRule.JPG
  • A Simultaneous List can be set to complete when:-
    • all the Child Rules are completed, OR
    • any one of the Child Rules has been completed.


Other Types of Lists

Progressive Lists

Rule details can be found at Progressive List Rule

DotPoint.JPG On the first run of a Progressive List, only the first Child Rule is executed. On the second run, the second Child Rule is executed, on the third run the third Child Rule is executed, etc.
ProgressiveListRules.JPG

A Progressive List can be set to:-

  • repeat the sequence after the last child rule has been executed, OR
  • terminate (no further repeats) after the last child rule has been executed

Random Lists

Rule details can be found at Random List Rule

DotPoint.JPG A Random List will run ONLY ONCE and will randomly select a single Child Rule to execute.
RandomListRules.JPG

Reset Lists

Rule details can be found at Reset List Rule

DotPoint.JPG A Reset List will execute continuously, it will never terminate. Each time through the list all the Child Rules will be reset and executed again.
ResetListRules.JPG



Trainz Wiki


Route Creation Tutorials:


Session Creation Tutorials:

Personal tools