Variable Modify Rule

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Upper/Lower Limits)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Image:VariableModifyRule_Icon.jpg|right]]
 
[[Image:VariableModifyRule_Icon.jpg|right]]
 
The Variable Modify Rule is used to define and modify a custom integer variable within a [[Session|session]]. The variable can then be shown to the player via the [[Variable Show Rule]] or tested to affect the session outcome via the [[Variable Check Rule]].
 
The Variable Modify Rule is used to define and modify a custom integer variable within a [[Session|session]]. The variable can then be shown to the player via the [[Variable Show Rule]] or tested to affect the session outcome via the [[Variable Check Rule]].
 +
 +
'''What is a variable?'''
 +
 +
A variable is an identifier linked to a numeric value which once set can be updated as a result of an event or series of events.  A variable can be accessed and measured at any time, and used to trigger outcomes or consequences that are assigned to specific values. 
 +
  
 
=== Configuration Options ===
 
=== Configuration Options ===
Line 15: Line 20:
 
==== Variable Name ====
 
==== Variable Name ====
 
Specifies the variable name. Variable names are used to identify the variable between rules. They can be anything you like, but be sure the name is meaningful or you may forget what it does.
 
Specifies the variable name. Variable names are used to identify the variable between rules. They can be anything you like, but be sure the name is meaningful or you may forget what it does.
 +
 +
TBD: Are there any limits or guidelines for variable names? Are they case sensitive? Are there any reserved or regularly used names?
 +
 +
TBD: What is the initial value of an unused variable?
  
 
==== Undo ====
 
==== Undo ====
 
In the add and subtract modes it is possible to have the addition/subtraction undone if the rule execution is stopped. This can be handy for performing tests such as whether a train is at a specific location.
 
In the add and subtract modes it is possible to have the addition/subtraction undone if the rule execution is stopped. This can be handy for performing tests such as whether a train is at a specific location.
 +
 +
TBD: What does 'stopped' mean in this context? How do I stop a rule?
  
 
==== Upper/Lower Limits ====
 
==== Upper/Lower Limits ====
 
You can optionally have the rule specify a minimum and maximum value for your defined variable. This option is disabled by default.
 
You can optionally have the rule specify a minimum and maximum value for your defined variable. This option is disabled by default.
  
 +
TBD: Does this minimum and maximum apply only to this modification, or does it stay in force on the variable for future modifications?
 +
TBD: What happens if some modifications under- or overrun this limits?
  
 
[[Category:Rules]]
 
[[Category:Rules]]
 +
[[Category:TBD]]

Latest revision as of 03:48, 8 January 2021

VariableModifyRule Icon.jpg

The Variable Modify Rule is used to define and modify a custom integer variable within a session. The variable can then be shown to the player via the Variable Show Rule or tested to affect the session outcome via the Variable Check Rule.

What is a variable?

A variable is an identifier linked to a numeric value which once set can be updated as a result of an event or series of events. A variable can be accessed and measured at any time, and used to trigger outcomes or consequences that are assigned to specific values.


Contents

[edit] Configuration Options

[edit] Mode

The rule can be run in three different modes:
Add: Adds the amount specified to the variable upon execution
Subtract: Subtracts the amount specified from the variable upon execution
Change: Sets the value of the variable to the specified amount upon execution

[edit] Amount

Specifies the amount to be added to, subtracted from, or set to for the variable.

[edit] Variable Name

Specifies the variable name. Variable names are used to identify the variable between rules. They can be anything you like, but be sure the name is meaningful or you may forget what it does.

TBD: Are there any limits or guidelines for variable names? Are they case sensitive? Are there any reserved or regularly used names?

TBD: What is the initial value of an unused variable?

[edit] Undo

In the add and subtract modes it is possible to have the addition/subtraction undone if the rule execution is stopped. This can be handy for performing tests such as whether a train is at a specific location.

TBD: What does 'stopped' mean in this context? How do I stop a rule?

[edit] Upper/Lower Limits

You can optionally have the rule specify a minimum and maximum value for your defined variable. This option is disabled by default.

TBD: Does this minimum and maximum apply only to this modification, or does it stay in force on the variable for future modifications? TBD: What happens if some modifications under- or overrun this limits?

Personal tools