Reverse Polish Notation: Difference between revisions

From FSDeveloper Wiki
Jump to navigationJump to search
(Created page for reverse polish notation)
 
m (Replaced Applicable-FSVersion for MSFS with MSFS2020, added MSFS2024)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Infobox-Applicable-FSVersion
{{Infobox-Applicable-FSVersion
| MSFS = true
| MSFS2024 = unknown
| MSFS2020 = true
| FSXI = false
| FSXI = false
| P3D5 = false
| P3D5 = false
Line 19: Line 20:
Reverse Polish Notation, or RPN, is a way to write down formulas. It is used in MSFS for gauges, [https://docs.flightsimulator.com/html/index.htm#t=Content_Configuration%2FModels%2FModelBehaviors%2FModel_Behaviors.htm model behaviors], and in mission scripts for [[Property Trigger|PropertyTriggers]], [[Proximity Trigger|ProximityTriggers]], and [[MSFS Mission Script - Calculator|Calculators]].
Reverse Polish Notation, or RPN, is a way to write down formulas. It is used in MSFS for gauges, [https://docs.flightsimulator.com/html/index.htm#t=Content_Configuration%2FModels%2FModelBehaviors%2FModel_Behaviors.htm model behaviors], and in mission scripts for [[Property Trigger|PropertyTriggers]], [[Proximity Trigger|ProximityTriggers]], and [[MSFS Mission Script - Calculator|Calculators]].


The [https://docs.flightsimulator.com/html/index.htm#t=Additional_Information%2FReverse_Polish_Notation.htm documentation] on RPN thoroughly explains how it works.
'''The [https://docs.flightsimulator.com/html/index.htm#t=Additional_Information%2FReverse_Polish_Notation.htm documentation] on RPN thoroughly explains how it works.
'''
 
== Mission Script Elements that use RPN ==
{|class='wikitable'
|[[MSFS_Mission_Script_-_Calculator|Calculator]]
|-
|[[Property_Trigger|PropertyTrigger]]
|-
|[[Execute_RPN_Action|ExecuteRPNAction]]
|}
 
== Examples ==
=== Changing a variable ===
You can change a variable with RPN code in a [[MSFS_Mission_Script_-_Calculator|Calculator]] or [[Execute RPN Action]].
1800 (>X:VariableToChange)
This example changes the variable <code>VariableToChange</code> to 1800.
 
=== If, Else construction ===
(condition) if{this} els{that}
If the condition is true, the formula will become <code>{this}</code>, otherwise it will become <code>{that}</code>.

Latest revision as of 12:21, 25 May 2024

Reverse Polish Notation, or RPN, is a way to write down formulas. It is used in MSFS for gauges, model behaviors, and in mission scripts for PropertyTriggers, ProximityTriggers, and Calculators.

The documentation on RPN thoroughly explains how it works.

Mission Script Elements that use RPN

Calculator
PropertyTrigger
ExecuteRPNAction

Examples

Changing a variable

You can change a variable with RPN code in a Calculator or Execute RPN Action.

1800 (>X:VariableToChange)

This example changes the variable VariableToChange to 1800.

If, Else construction

(condition) if{this} els{that}

If the condition is true, the formula will become {this}, otherwise it will become {that}.