MSFS Mission Script - Calculator
| This page is a work-in-progress. Generic message - Please note some detail may possibly be missing or incorrect. |
| Applicable |
|---|
| MSFS2024 |
| MSFS2020 |
| MS Flight |
| LM P3D5 |
| LM P3D4 |
| LM P3D3 |
| LM P3D2 |
| LM P3D |
| FS World |
| FSXSE |
| FSXA |
| FSX |
| FS2004 |
| FS2002 |
| XP11 |
| XP10 |
| XP9 |
You can use calculators for more advanced logic in your mission. It can take in multiple variables and trigger different actions based on a logic. You can also use this to calculate a mission score and probably many more applications which you can think of. See MSFS Mission Script for general information about creating a mission script.
Calculator object
A calculator has four main parts:
| CalculatorFormula | CalculatorFormulas are the most important part of the calculator. They are written in Reverse Polish Notation and can be used as a condition (same as in a PropertyTrigger) or as an action (same as in a ExecuteRPNAction) or both at the same time. |
|---|---|
| CalculatorValue | A calculator has a CalculatorValue that can be used by objects that use RPN. This value is determined by the main CalculatorFormula, StartValue, OnActivatedValue, and OnDeactivatedValue. |
| CalculatorParameters | A calculator can have parameters, which are Calculator Variables that can be used in CalculatorFormulas. See: the list of parameter types. |
| CalculatorActions | A calculator can have associated actions that execute when the calculator is activated, deactivated, or when a condition has been met. |
Calculator parameters / variables
You can create a Calculator Variable by adding a CalculatorParameter to a calculator. In NameInFormula you give the variable a name. You can later reference the Calculator Variable using (X:VariableName) or [VariableName].
List of parameter types
| ReferenceParameter | You can use another Calculator's CalculatorValue as a parameter. |
|---|---|
| FormulaParameter | You can use RPN code as a reference. Which means you can use all variables such as SimVars and Calculator Variables. |
| InputParameter | You can use a user input as a parameter. |
| RunwayParameter | You can add data relating to runways as a parameter. |
| PathParameter | You can add data relating to paths as a parameter. |
| MouseParameter | You can add the position of the mouse as a parameter. |
| RacerParameter | You can add data relating to players in a race as a parameter. |
Calculator Actions
| DeactivateAfterExecution | Deactivate the entire calculator after execution. |
|---|---|
| CalculatorFormula | If this formula is true, the actions will execute. |
| NameInFormula | This CalculatorFormula can also be referenced. |
| StartValue | Starting value of the CalculatorFormula. |
| On(De)ActivatedValue | What the value will change to when the calculator is activated. |
| OnActionCompleteFormula | Formula to execute when all the actions have finished. |
| Actions | Actions that execute when the CalculatorFormula is true. |
Evaluator
TrackerSimVar
Notes: when a CalculatorFormula uses its own parameter, it will stay a variable
what is (X:dtime), time between calls of calculator?
What if NameInFormula creates duplicate names?
(X:) or [] difference?
- Flightplan
- Weather definitions
- Flight file
- Mission script
- Triggers
- Actions
- ObjectActivationAction · DialogAction · AdjustPayloadAction · ChangeAssistanceItemAction · FadeToColorAction · RandomAction · RequestTeleportAction · CountAction · ResetTimerAction · TimerAdjustAction · GoalResolutionAction & SubGoalResolutionAction · GrantRewardAction · PointOfInterestActivationAction · ActivateWaypointsAction · AITakeControlsAction · SendMessageToAIAction
- Mission objects
- Calculator
- Flow states
- Events
- Areas
- Library objects
- Sim objects
- RTC