MSFS Mission Script - Calculator

From FSDeveloper Wiki
Jump to navigationJump to search


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?

Pages relevant to mission creation for MSFS.

Mission structure

Flightplan
Weather definitions
Flight file
Mission script
Triggers
AirportLandingTrigger & AreaLandingTrigger · CounterTrigger · PropertyTrigger · ProximityTrigger · TimerTrigger
Actions
ObjectActivationAction · DialogAction · AdjustPayloadAction · ChangeAssistanceItemAction · FadeToColorAction · RandomAction · RequestTeleportAction · CountAction · ResetTimerAction · TimerAdjustAction · GoalResolutionAction & SubGoalResolutionAction · GrantRewardAction · PointOfInterestActivationAction · ActivateWaypointsAction · AITakeControlsAction · SendMessageToAIAction
Mission objects
Mission definition · Goal · LivingWorldExclusion · Camera
Calculator
Flow states
Events
Areas
Rectangle Area · Cylinder Area · Polygon Area · Corridor Area · InGameMarker
Library objects
Sim objects
RTC

Mission tools

MSFS Script Editor · BushTripInjector · BushMissionGen · MSFSLocalizer · SPB2XML · Little Navmap

Other

Example mission files
Porting FSX Missions to MSFS
Localisation
Click the links to access the topic pages (Default - Opens in same window).