How to Use Parent and Child Rules
m (→Trainz Wiki) |
Builderbob (Talk | contribs) m (Restate definition of Parent and Child so Child is included.) |
||
Line 1: | Line 1: | ||
='''What Are Parent and Child Rules?'''= | ='''What Are Parent and Child Rules?'''= | ||
− | Most '''Parent Rules''' are used as "decision makers" in | + | Session rules are arranged in a hierarchical fashion. A '''Parent Rule''' can be used to group a set of rules at a lower level in the hierarchy. The rules that are grouped under a '''Parent Rule''' are '''Child Rules'''. These '''Child Rules''' can also be '''Parent Rules''', thus creating multiple levels in the hierarchy. |
+ | |||
+ | Most '''Parent Rules''' are used as "decision makers" in Trainz Sessions: they provide a result which determines if or when other rules (the '''Child Rules''') will be executed. Other parent rules have predefined conditions which control how their '''Child Rules''' are executed. | ||
<table cellpadding="4" bgcolor=#c1e7e7> | <table cellpadding="4" bgcolor=#c1e7e7> |
Revision as of 07:55, 2 January 2019
Contents |
What Are Parent and Child Rules?
Session rules are arranged in a hierarchical fashion. A Parent Rule can be used to group a set of rules at a lower level in the hierarchy. The rules that are grouped under a Parent Rule are Child Rules. These Child Rules can also be Parent Rules, thus creating multiple levels in the hierarchy.
Most Parent Rules are used as "decision makers" in Trainz Sessions: they provide a result which determines if or when other rules (the Child Rules) will be executed. Other parent rules have predefined conditions which control how their Child Rules are executed.
Rules that act as Parent Rules can have one or more sub-rules or Child Rules indented under them. |
Notes:
|
Rules that act as Child Rules are indented under a Parent Rule. |
|
Parent/Child Rule Example
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.
- 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
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. 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.
- The Simultaneous List Rule, a Parent Rule, is then executed. It executes all its Child Rules immediately and simultaneously.
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
Ordered Lists are shown with numbered icons on each Child Rule which indicates the order in which they will be executed. |
|
Each Child Rule in the sequence must be completed before the next Child Rule can be executed. |
Simultaneous Lists
Rule details can be found at Simultaneous List Rule
Simultaneous Lists are shown with equality ("=") icons on each Child Rule which indicates that they will be executed at the same time. |
|
Other Types of Lists
Progressive Lists
Rule details can be found at Progressive List Rule
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. |
|
Random Lists
Rule details can be found at Random List Rule
A Random List will run ONLY ONCE and will randomly select a single Child Rule to execute. |
Reset Lists
Rule details can be found at Reset List Rule
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. |
Trainz Wiki
More Tutorials and Guides to Using Trainz |