Skip to content

MASFlightComputerProxy3

MOARdV edited this page Jan 2, 2019 · 48 revisions

MASFlightComputerProxy3.cs

Contents

The fc group contains the core interface between KSP, Avionics Systems, and props in an IVA. It consists of many 'variable' functions that can be used to get information as well as numerous 'action' functions that are used to do things.

Due to the number of methods in the fc group, this document has been split across three pages:

NOTE: If a variable listed below includes an entry for 'Required Mod(s)', then the mod listed (or any of the mods, if more than one) must be installed for that particular feature to work.


Resources Category

The resource methods report the availability of various resources aboard the vessel. They are grouped into three types.

'Power' methods PowerCurrent(), etc, report the state of the resource identified in the MAS config file. By default, this is ElectricCharge, but mods may use a different resource for power, instead. By using the 'Power' methods, IVA makers do not have to worry about adapting their IVA configurations for use with modded configurations, as long as the player has correctly configured MAS to use the alternative power name.

'Propellant' methods track all of the active fuel types being used by ModuleEngines and ModuleEnginesFX. Instead of reporting the current and maximum amounts in units, like the 'Resource' methods do, these methods report amounts in kilograms. Using the propellant mass allows these methods to track alternate fuel types (such as mods using LHyd + Oxidizer), with the downside being mixed engine configurations, such as solid rockets + liquid-fueled engines) may be less helpful

'Rcs' methods work similarly to the 'Propellant' methods, but they track resource types consumed by ModuleRCS and ModuleRCSFX.

'Resource' methods that take a numeric parameter are ordinal resource listers. The numeric parameter is a number from 0 to fc.ResourceCount() - 1. This allows the IVA maker to display an alphabetized list of resources (on an MFD, for instance).

'Resource' methods that take a string parameter return the named resource. The name must match the name field of a RESOURCE_DEFINITION config node, or 0 will be returned.

fc.PowerCurrent()

Returns: Current units of power.

Returns the current level of available power for the designated "Power" resource; by default, this is ElectricCharge.

fc.PowerDelta()

Returns the rate of change in available power (units/sec) for the designated "Power" resource; by default, this is ElectricCharge.

fc.PowerMax()

Returns the maximum capacity of the resource defined as "power" in the config. By default, this is ElectricCharge.

fc.PowerPercent()

Returns the current percentage of maximum capacity of the resource designated as "power" - in a stock installation, this would be ElectricCharge.

fc.PowerThreshold(double firstBound, double secondBound)

  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if the power percentage is between the listed bounds.

Reports whether the vessel's power percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no power onboard, returns 0. Doing so makes this function useful for alerts, for example.

fc.PropellantCurrent()

Returns: The current quantity of the active propellants in the vessel, in U.

Reports the total quantity in units (U) of resources currently being consumed by all active engines on the vessel.

fc.PropellantDelta()

Returns: The current propellant consumption rate, in U/s.

Reports the propellant consumption rate in U/s for all active engines on the vessel.

fc.PropellantDensity()

Returns: Propellant density in kg/U.

Returns the current density of the propellant. Note that because different propellants for different engines may be consumed at different rates, the density is only valid for the current propellant quantity. It should not be used to determine maximum propellant mass, unless you know in advance that all active propellants load are consumed at the same rate.

fc.PropellantMass()

Returns: The current propellant mass, in kg.

Reports the current mass of the propellant.

fc.PropellantMax()

Returns: The maximum propellant capacity, in U.

Reports the maximum amount of propellant, in units (U), that may be carried aboard the vessel.

fc.PropellantPercent()

Returns: The percentage of maximum propellant capacity that contains propellant, between 0 and 1.

Reports the current percentage of propellant aboard the vessel.

fc.PropellantStageCount()

Reports the number of propellants currently in use.

fc.PropellantStageCurrent()

Returns: The current quantity of propellant accessible by the current stage, in U.

Reports the current amount of propellant available, in U, to active engines on the current stage.

fc.PropellantStageMax()

Returns: The maximum quantity of propellant accessible by the current stage, in U.

Reports the maximum amount of propellant available, in U, to the active engiens on the current stage.

fc.PropellantStageDisplayName(double index)

  • index: A number between 0 and fc.PropellantStageCount() - 1, inclusive.

Returns: The name of the propellant, or an empty string for invalid indices.

Returns the display (localized) name of the active propellant indexed by index. This call is equivalent to fc.ResourceDisplayName(fc.PropellantStageResourceId(index)).

fc.PropellantStageName(double index)

  • index: A number between 0 and fc.PropellantStageCount() - 1, inclusive.

Returns: The name of the propellant, or an empty string for invalid indices.

Returns the name of the active propellant indexed by index. This call is equivalent to fc.ResourceName(fc.PropellantStageResourceId(index)).

fc.PropellantStagePercent()

Returns: The percentage of maximum stage propellant capacity that contains propellant, between 0 and 1.

Reports the percentage of propellant remaining on the current stage for the active engines.

fc.PropellantStageResourceId(double index)

  • index: A number between 0 and fc.PropellantStageCount() - 1, inclusive.

Returns: The resourceId of the propellant, or -1 for invalid indices.

Returns the resourceId of the active propellant indexed by index. This value can be used in the various Resource methods in this category.

fc.PropellantStageThreshold(double firstBound, double secondBound)

  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if current stage propellant is between the listed bounds.

Reports whether the current stage propellant percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no propellant on the current stage, returns 0. Doing so makes this function useful for alerts, for example.

fc.PropellantThreshold(double firstBound, double secondBound)

  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if propellant is between the listed bounds.

Reports whether the vessel's propellant percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no propellant or active engines, returns 0. Doing so makes this function useful for alerts, for example.

fc.RcsCurrent()

Returns: Total RCS propellant quantity in units.

Tracks the current units of all resources consumed by installed RCS thrusters.

fc.RcsDelta()

Returns: RCS propellant consumption rate in units/s.

Tracks the current resource consumption rate by installed RCS thrusters.

fc.RcsDensity()

Returns: RCS propellant consumption rate in kg/U.

Reports the current density of propellant for all RCS thrusters.

fc.RcsMass()

Returns: Current RCS propellant mass, in kg.

Reports the current mass of RCS propellant accessible by the current stage.

fc.RcsMax()

Returns: Maximum propellant capacity in units.

Tracks the total units that can be carried in all RCS propellant tanks.

fc.RcsPercent()

Returns: Current RCS propellant supply, between 0 and 1.

Tracks the percentage of total RCS propellant mass currently onboard.

fc.RcsStageCurrent()

Returns: Available RCS propellant, in units.

Reports the current amount of RCS propellant available to the active stage.

fc.RcsStageMax()

Returns: Maximum stage RCS propellant mass, in units.

Reports the maximum amount of RCS propellant storage accessible by the current stage.

fc.RcsStagePercent()

Returns: Current stage percentage, between 0 and 1.

Reports the percentage of RCS propellant mass available to the current stage.

fc.RcsStageThreshold(double firstBound, double secondBound)

  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if current stage RCS propellant is between the listed bounds.

Reports whether the current stage RCS propellant percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no RCS propellant on the current stage, returns 0. Doing so makes this function useful for alerts, for example.

fc.RcsThreshold(double firstBound, double secondBound)

  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if RCS propellant is between the listed bounds.

Reports whether the vessel's RCS propellant percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no RCS propellant, returns 0. Doing so makes this function useful for alerts, for example.

fc.ResourceCount()

Returns the total number of resources found on this vessel.

fc.ResourceCurrent(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the current amount of the selected resource.

fc.ResourceDelta(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the instantaneous change-per-second of the selected resource, or zero if the resource is invalid.

A positive number means the resource is being consumed (burning fuel, for instance).

fc.ResourceDensity(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns: Density in kg / unit

Returns the density of the selected resource, or zero if it is invalid.

fc.ResourceExists(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns 1 if resourceId is valid (there is a resource with that id on the craft).

fc.ResourceIsPropellant(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns: 1 if the resource is currently a propellant, 0 otherwise.

Returns 1 if the identified resource is currently marked as a propellant.

fc.ResourceMass(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the current mass of the selected resource in kg.

fc.ResourceMassMax(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the maximum mass of the selected resource.

fc.ResourceMax(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the maximum quantity of the selected resource.

fc.ResourceDisplayName(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the display (localized) name of the selected resource, or an empty string if it doesn't exist.

fc.ResourceName(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the name of the selected resource, or an empty string if it doesn't exist.

fc.ResourcePercent(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the amount of the selected resource remaining as a percentage in the range [0, 1].

fc.ResourceStageCurrent(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the current amount of the selected resource in the current stage.

fc.ResourceStageMass(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the current mass of the selected resource in the current stage.

fc.ResourceStageMassMax(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the maximum mass of the selected resource in the current stage.

fc.ResourceStageMax(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the max amount of the selected resource in the current stage.

fc.ResourceStagePercent(object resourceId)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.

Returns the max amount of the selected resource in the current stage.

fc.ResourceStageThreshold(object resourceId, double firstBound, double secondBound)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.
  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if current stage resource percentage is between the listed bounds.

Reports whether the named resource's current stage percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no such resource on the current stage, returns 0. Doing so makes this function useful for alerts, for example.

fc.ResourceThreshold(object resourceId, double firstBound, double secondBound)

  • resourceId: A number between 0 and fc.ResourceCount()-1 or the name of a resource.
  • firstBound: The first boundary percentage, between 0 and 1.
  • secondBound: The second boundary percentage, between 0 and 1.

Returns: 1 if the resource percentage is between the listed bounds.

Reports whether the vessel's total resource percentage falls between the two listed bounds. The bounds do not need to be in numerical order.

If there is no resource capacity onboard, returns 0. Doing so makes this function useful for alerts, for example.

fc.VesselPowered()

Returns: 1 if there is ElectricCharge, 0 otherwise.

Returns 1 when there is at least 0.0001 units of power available to the craft. By default, 'power' is the ElectricCharge resource, but users may change that in the MAS config file.


Resource Converter Category

The Resource Converter category allows an IVA creator to register to track specific resources converters (ModuleResourceConverter) that are of interest to the IVA. By default, the MASFlightComputer installs a Resource Converter tracker for "ElectricCharge" (or whatever override resource is configured in the persistent file) as id number 0. This tracker is used to provide information for the Fuel Cell functions (FuelCellCount(), etc).

Any number of trackers may be installed. The only requirement is that each must be given a unique id that is a positive integer (1 or higher). When assigning a ModuleResourceConverter that has multiple outputs to a group, MAS will place it in the group with the highest id.

For example, say a ModuleResourceConverter took "Water" as an input, and it generated "LqdHydrogen" and "Oxidizer" for output. If Resource Converter group 1 tracked "LqdHydrogen" output and group 2 tracked "Oxidizer", then this resource converter would be assigned to group 2, since it is the highest priority resource of the two listed.

If an IVA tries to register more than one resource type to the same id, only the first one found will be registered. For instance, if a MASFlightComputer script attempts to call fc.TrackResourceConverter(1, "LqdHydrogen") and then calls fc.TrackResourceConverter(1, "Oxidizer"), then group 1 will track "LqdHydrogen". MAS will return a -1 on the second call to indicate that the requested group id is already in use with a different resource.

fc.GetResourceConverterActive(double id)

  • id: The id number of the resource converter group to query. Must be an integer 0 or larger.

Returns: 1 if any selected resource converter is switched on; 0 otherwise.

Returns 1 if at least one resource converter in the group selected by id is enabled; 0 otherwise.

fc.ResourceConverterCount(double id)

  • id: The id number of the resource converter group to query. Must be an integer 0 or larger.

Returns the number of resource converters that generate the output selected by the resource converter group id.

fc.ResourceConverterOutput(double id)

  • id: The id number of the resource converter group to query. Must be an integer 0 or larger.

Returns: Units of the resource generated per second.

Returns the current output of installed fuel cells.

fc.SetResourceConverterActive(double id, bool newState)

  • id: The id number of the resource converter group to query. Must be an integer 0 or larger.

Returns: 1 if resource converters are now active, 0 if they're off or they could not be toggled.

Sets the resource converter group selected by id on or off.

fc.ToggleResourceConverterActive(double id)

  • id: The id number of the resource converter group to query. Must be an integer 0 or larger.

Returns: 1 if resource converters are now active, 0 if they're off or they could not be toggled.

Toggles the resource converter group selected by id on or off.

fc.TrackResourceConverter(double id, string resourceName)

  • id: The id number to assign to this resource. Must be an integer 1 or larger.
  • resourceName: The name of the resource (from the name field of a RESOURCE_DEFINITION).

Returns: 1 if the converter was registered (or was already registered with the same id), -1 if a resource converter was registered using that id with a different resourceName, and 0 if an invalid id was provided.

Registers a family of Resource Converters with MAS. A resource converter is defined by two components: the id and the resourceName.

The id defines the priority, with larger numbers indicating a higher priority. When a specific ModuleResourceConverter has more than one output, MAS will add the module to the highest-priority tracked resource converter.

For example, if a particular resource converter outputs "LiquidFuel" and "Oxidizer", and "LiquidFuel" is registered as id = 1, and "Oxidizer" is registered as id = 2, then MAS will treat that resource converter as id = 2 with an "Oxidizer" output.

If more than one call to TrackResourceConverter uses the same id with different resourceName values, only the first such call applies. Additional calls using a different resourceName will have no effect, and TrackResourceConverter() will return -1.

id must be a positive number. id = 0 is reserved for "ElectricCharge", which corresponds with the Fuel Cell methods. If a call to TrackResourceConverter uses "ElectricCharge" with an id greater than zero, then the Fuel Cell methods will behave as if no fuel cells are installed.

The resourceName must be one of the name fields for a RESOURCE_DEFINITION, such as "ElectricCharge" in GameData/Squad/Resources/ResourcesGeneric.cfg. If an invalid resourceName is provided (for instance, if it is for a resource included in a mod that is not installed), there are no errors - MAS behaves as if there are no relevant resource converters.


SAS Category

The SAS section provides methods to control and query the state of a vessel's SAS stability system.

fc.GetPrecisionMode()

Returns: 1 if the controls are in precision mode, 0 if they are not.

Returns whether the controls are configured for precision mode.

fc.GetSAS()

Returns 1 if SAS is on, 0 otherwise.

fc.GetSASMode()

Returns: A number between 0 and 9, inclusive.

Returns a number representing the SAS mode:

  • 0 = StabilityAssist
  • 1 = Prograde
  • 2 = Retrograde
  • 3 = Normal
  • 4 = Anti-Normal
  • 5 = Radial In
  • 6 = Radial Out
  • 7 = Target
  • 8 = Anti-Target
  • 9 = Maneuver Node

fc.GetSASSpeedMode()

Return the current speed display mode: 1 for orbit, 0 for surface, and -1 for target.

fc.SASHasActions()

Returns 1 if the SAS action group has actions assigned to it.

fc.SetPrecisionMode(bool state)

  • state: 'true' to enable precision control, 'false' to disable it.

Returns: 1 if precision mode is now on, 0 if it is now off.

Activates or deactivates precision control mode.

fc.SetSAS(bool active)

Returns: 1 if the SAS action group is on, 0 otherwise.

Set the SAS state to on or off per the parameter.

fc.SetSASMode(double mode)

  • mode: One of the modes listed above. If an invalid value is provided, Stability Assist is set.

Returns: 1 if the mode was set, 0 if an invalid mode was specified

Set the SAS mode. Note that while you can set this mode when SAS is off, KSP sets it back to Stability Assist when SAS is switched on. Valid modes are:

  • 0 = StabilityAssist
  • 1 = Prograde
  • 2 = Retrograde
  • 3 = Normal
  • 4 = Anti-Normal
  • 5 = Radial In
  • 6 = Radial Out
  • 7 = Target
  • 8 = Anti-Target
  • 9 = Maneuver Node

fc.TogglePrecisionMode()

Returns: 1 if precision mode is now on, 0 if it is now off.

Toggle precision control mode

fc.ToggleSAS()

Returns: 1 if SAS is now on, 0 if it is now off.

Toggles SAS on-to-off or vice-versa

fc.ToggleSASSpeedMode()

Returns: The new speed mode (see fc.GetSASSpeedMode()).

Toggles the SAS speed mode.


Speed, Velocity, and Acceleration Category

Variables related to the vessels speed, velocity, and accelerations are grouped in this category.

fc.AccelEngines()

Returns: Engine acceleration in m/s^2.

Returns the current acceleration of the vessel from engines, in m/s^2.

fc.Acceleration()

Returns: Net acceleration in m/s^2.

Returns the net acceleration on the vessel from all forces in m/s^2.

fc.AccelForward()

Returns: Forward acceleration in m/s^2.

Returns the forward (towards the vessel nose) component of the net acceleration on the vessel in m/s^2. Negative values represent a rearward acceleration.

fc.AccelRight()

Returns: Right acceleration in m/s^2.

Returns the rightward component of the net acceleration on the vessel in m/s^2. Negative values represent a leftward acceleration.

fc.AccelSurfaceForward()

Returns: Surface forward acceleration in m/s^2.

Returns the surface forward-relative component of the net acceleration on the vessel in m/s^2.

fc.AccelSurfacePrograde()

Returns: Surface prograde acceleration in m/s^2.

Returns the surface prograde-relative component of the net acceleration on the vessel in m/s^2.

fc.AccelSurfaceRight()

Returns: Surface right acceleration in m/s^2.

Returns the surface right-relative component of the net acceleration on the vessel in m/s^2.

fc.AccelTop()

Returns: Top acceleration in m/s^2.

Returns the top (towards the 'top' of an aircraft, or the typical 'up' direction of kerbals in pods) component of the net acceleration on the vessel in m/s^2. Negative values represent a vessel-downward acceleration.

fc.AccelUp()

Returns: Top acceleration in m/s^2.

Returns the surface-relative up component of the net acceleration on the vessel in m/s^2. Negative values represent acceleration towards the surface.

fc.AltitudeTerrainRate()

Returns: Rate of change of terrain altitude in m/s.

Returns the rate at which the vessel's distance to the ground is changing. This is the vertical speed as measured from vessel to surface, as opposed to measuring from a fixed altitude. When over an ocean, sea level is used as the ground height (in other words, fc.AltitudeTerrain(false)).

Because terrain may be rough, this value may be noisy. It is smoothed using exponential smoothing, so the rate is not instantaneously precise.

fc.ApproachSpeed()

Returns: Approach speed in m/s. Returns 0 if there is no target.

Returns the approach speed (the rate of closure directly towards the target). Returns 0 if there's no target or all relative movement is perpendicular to the approach direction.

fc.CurrentSpeedModeSpeed()

Returns: Current speed in m/s.

Returns the speed selected by the speed mode (surface, orbit, or target) in m/s. This value is equivalent to the speed displayed over the NavBall in the UI.

fc.EquivalentAirspeed()

Returns: EAS in m/s.

Compute equivalent airspeed based on current surface speed and atmospheric density.

https://en.wikipedia.org/wiki/Equivalent_airspeed

fc.GForce()

Returns: Current instantaneous force in Gs.

Returns the magnitude of g-forces currently affecting the craft, in gees.

fc.GForceVertical()

Returns: The number of Gs towards the head or feet of the crew.

Returns the magnitude of g-forces perpendicular to the front of the craft aligned with the normal seating configuration of the crew. For aircraft and most spacecraft, positive values indicates forces towards the feet of the crew, while negative values indicate forces towards the heads of the crew.

Excessive positive values could cause blackouts, while excessive negative values may cause redouts.

fc.HorizontalSpeed()

Returns: Horizontal surface speed in m/s.

Measure of the surface speed of the vessel after removing the vertical component, in m/s.

fc.IndicatedAirspeed()

Returns: IAS in m/s.

Returns the indicated airspeed in m/s, based on current surface speed, atmospheric density, and Mach number.

fc.MachNumber()

Returns: Vessel speed as a factor of the speed of sound.

Returns the vessel's current Mach number (multiple of the speed of sound). This number only makes sense in an atmosphere.

fc.OrbitSpeed()

Returns: Orbital speed in m/s.

Return the orbital speed of the vessel in m/s

fc.SpeedDisplayMode()

Returns: 1 for "Orbit" mode, 0 for "Surface" mode, and -1 for "Target" mode.

Returns +1 if the KSP automatic speed display is set to "Orbit", +0 if it's "Surface", and -1 if it's "Target". This mode affects SAS behaviors, so it's useful to know.

fc.SurfaceForwardSpeed()

Returns: The vessel's velocity fore/aft velocity in m/s.

Returns the component of surface velocity relative to the nose of the craft, in m/s. If the vessel is near vertical, the 'forward' vector is treated as the vector that faces 'down' in a horizontal cockpit configuration.

fc.SurfaceLateralSpeed()

Returns: The vessel's left/right velocity in m/s. Right is positive; left is negative.

Returns the lateral (right/left) component of surface velocity in m/s. This value could become zero at extreme roll orientations. Positive values are to the right, negative to the left.

fc.SurfaceSpeed()

Returns: Surface speed in m/s.

Return the surface-relative speed of the vessel in m/s.

fc.TargetSpeed()

Returns: Speed relative to the target in m/s. 0 if there is no target.

Target-relative speed in m/s. 0 if no target.

fc.VerticalSpeed()

Returns: Surface-relative vertical speed in m/s.

Returns the vertical speed of the vessel in m/s.


Staging Category

Controls for staging a vessel, and controlling the stage lock, and information related to both staging and stage locks are all in the Staging category.

fc.CurrentStage()

Returns: A whole number 0 or larger.

Returns the current stage. Before launch or after undocking, this number may be larger than the total number of stages on the vessel.

fc.GetStageLocked()

Returns: 1 if staging is locked, 0 if staging is unlocked.

Returns 1 if staging is locked, 0 otherwise.

fc.SetStageLocked(bool locked)

  • locked: true to lock staging, false to unlock staging.

Returns: 1 if staging is locked, 0 otherwise.

Sets stage locking to the specified setting (true or false).

fc.Stage()

Returns: 1 if the vessel staged; 0 otherwise.

Activate the next stage.

fc.StageReady()

Returns: 1 if the vessel can stage, and staging is unlocked; 0 otherwise.

Can the vessel stage?

fc.StageValid()

Returns: 1 if CurrentStage refers to a stage on the vessel, 0 if it does not.

The staging manager sets the 'current stage' to 1 greater than the number of stages on the vessel when a new vessel spawns (either at the launch pad, or after undocking). Doing so allows the vessel to sit on the launch pad without the last stage firing.

However, since the same thing happens after undocking, it is possible that the vessel's staging system is off-by-one, meaning that an engine on the last stage won't be available without staging, first.

This function returns 1 if the staging manager Current Stage is the same as the vessel's Last Stage, meaning that fc.CurrentStage() shows a valid stage on the vessel. It returns 0 prior to launch, or immediately after undocking, when the current stage is larger than the number of stages on the vessel.

fc.ToggleStageLocked()

Returns: 1 if staging is now locked; 0 if staging is now unlocked.

Toggle the stage lock on or off. Returns the new state.


Survival Category

Information related to the survivability of the current pod are grouped in the Survival category.

fc.MaxImpactSpeed()

Returns: Max impact speed of the command pod, in m/s.

Reports the maximum impact speed of the current part, in meters per second.

fc.SuicideBurnTime()

Returns: Time in seconds until the burn must start, or 0.

Required Mod(s): MechJeb, Kerbal Engineer Redux

Returns the time (in seconds) until a suicide burn (maximum thrust burn) must start to avoid lithobraking. If the orbit does not impact the surface, or it is too late to avoid impact, returns 0.

If Kerbal Engineer Redux is installed, MAS will use the KER prediction of time-of-impact. If KER is not installed, MAS uses its own estimate of time-to-impact.


Target and Rendezvous Category

The Target and Rendezvous section provides functions and methods related to targets and rendezvous operations with a target. These methods include raw distance and velocities as well as target name and classifiers (is it a vessel, a celestial body, etc).

fc.ClearTarget()

Returns: 1 if the target was cleared, 0 otherwise.

Clears any targets being tracked.

fc.ClearTargetFilter(double vesselType)

  • vesselType: An integer value between 1 and 13, inclusive.

Returns: 1 if the vesselType was cleared, 0 if it was not.

Removes the specified vesselType from the target tracking filter. vesselType must be one of:

  • 1 - Ship
  • 2 - Plane
  • 3 - Probe
  • 4 - Lander
  • 5 - Station
  • 6 - Relay
  • 7 - Rover
  • 8 - Base
  • 9 - EVA
  • 10 - Flag
  • 11 - Debris
  • 12 - Space Object
  • 13 - Unknown

Returns 1 if the provided vesselType was previously set, or 0 if it was not set or an invalid vesselType was supplied.

fc.GetTargetFilter(double vesselType)

  • vesselType: An integer value between 1 and 13, inclusive.

Returns: 1 if the vesselType was cleared, 0 if it was not.

Indicates whether the specified vesselType is set in the target selection filter. vesselType must be one of:

  • 1 - Ship
  • 2 - Plane
  • 3 - Probe
  • 4 - Lander
  • 5 - Station
  • 6 - Relay
  • 7 - Rover
  • 8 - Base
  • 9 - EVA
  • 10 - Flag
  • 11 - Debris
  • 12 - Space Object
  • 13 - Unknown

Returns 1 if the provided vesselType is a target that will be selected, or 0 if it will not be selected or an invalid vesselType was supplied.

fc.SetTargetFilter(double vesselType)

  • vesselType: An integer value between 1 and 13, inclusive.

Returns: 1 if the vesselType was set, 0 if it was not.

Adds the specified vesselType to the target tracking filter. vesselType must be one of:

  • 1 - Ship
  • 2 - Plane
  • 3 - Probe
  • 4 - Lander
  • 5 - Station
  • 6 - Relay
  • 7 - Rover
  • 8 - Base
  • 9 - EVA
  • 10 - Flag
  • 11 - Debris
  • 12 - Space Object
  • 13 - Unknown

Returns 1 if the provided vesselType was not previously set, or 0 if it was already set or an invalid vesselType was supplied.

fc.SetTargetVessel(double id)

  • id: The id of the vessel to target.

Returns: 1 if the target was successfully set, 0 otherwise.

Set the active target to the vessel selected by id. If the id is invalid, the current target is cleared. The id parameter must be greater than or equal to 0, and less than fc.TargetVesselCount() to be valid.

fc.TargetAltitude()

Returns: Target altitude in meters.

Returns the altitude of the target, or 0 if there is no target.

fc.TargetAngle()

Returns: Returns 0 if the target is directly in front of the vessel, or if there is no target; returns a number up to 180 in all other cases. Value is in degrees.

Returns the raw angle between the target and the nose of the vessel, or 0 if there is no target.

fc.TargetApoapsis()

Returns: Target's Ap in meters, or 0 if there is no target.

Returns the target's apoapsis.

fc.TargetBodyName()

Returns the name of the body that the target orbits, or an empty string if there is no target.

fc.TargetClosestApproachDistance()

Returns: Closest approach distance in meters, or 0 if there is no target.

Returns the distance of the closest approach to the target during the next orbit. If the target is a celestial body, the closest approach distance reports the predicted periapsis, with a value of 0 indicating lithobraking (impact).

fc.TargetClosestApproachSpeed()

Returns: Speed at closest approach in m/s, or 0 if there is no target.

Returns the relative speed of the target at closest approach. If there is no target, returns 0.

fc.TargetClosestApproachTime()

Returns: Time to closest approach in seconds, or 0 if there is no target.

Returns the time until the closest approach to the target.

fc.TargetDistance()

Returns: Target distance in meters, or 0 if there is no target.

Returns the distance to the current target in meters, or 0 if there is no target.

fc.TargetDistanceX()

Returns: Distance in meters. Positive means the target is to the right, negative means to the left.

Returns the displacement between the target vessel and the reference transform on the horizontal (reference-transform relative) plane in meters, with target to the right = +X and left = -X.

fc.TargetDistanceY()

Returns: Distance in meters. Positive means the target is above the craft, negative means below.

Returns the displacement between the target vessel and the reference transform on the vertical (rt-relative) plane in meters, with target up = +Y and down = -Y.

fc.TargetDistanceZ()

Returns: Distance in meters. Positive indicates a target in front of the craft, negative indicates behind.

Returns the displacement between the target vessel and the reference transform on the Z (fore/aft) axis in meters, with target ahead = +Z and behind = -Z

fc.TargetEccentricity()

Returns: Returns the target orbit's eccentricity.

Returns the eccentricity of the target's orbit, or 0 if there is no target.

fc.TargetHeadingPrograde()

Returns: Heading, or 0.

Returns the heading of the target's prograde surface speed, or 0 if there is no target, or the target does not have a meaningful surface heading.

NOTE: At present, only vessel targets return valid headings. All others return 0.

fc.TargetInclination()

Returns: Target orbital inclination in degrees, or 0 if there is no target.

Returns the orbital inclination of the target, or 0 if there is no target.

fc.TargetIsVessel()

Returns: 1 for vessel or docking port targets, 0 otherwise.

Returns 1 if the target is a vessel (vessel or Docking Port); 0 otherwise.

fc.TargetLatLonValid()

Returns: 1 for vessel, docking port, or waypoint targets, 0 otherwise.

Returns whether the latitude / longitude of the target are currently valid.

fc.TargetLatitude()

Returns: Latitude in degrees. Positive values are north of the equator, and negative values are south.

Returns the target latitude for targets that have valid latitudes.

fc.TargetLongitude()

Returns: Longitude in degrees. Negative values are west of the prime meridian, and positive values are east of it.

Returns the target longitude for targets that have valid longitudes.

fc.TargetName()

Returns: The name of the current target, or "" if there is no target.

Get the name of the current target, or an empty string if there is no target.

fc.TargetNextMoon()

Returns: Returns 1 if a moon was targeted. 0 otherwise.

Sets the target to the next moon of the body that vessel currently orbits. If there are no moons orbiting the current body, nothing happens.

If the vessel is currently targeting anything other than a moon of the current body, that target is cleared and the first moon is selected, instead.

Moon order is based on the order that the moons appear in the CelestialBody's list of worlds.

If the vessel is currently orbiting the Sun, this method will target planets.

fc.TargetNextVessel()

Returns: 1 if a vessel was targeted, 0 otherwise.

Sets the target to the nearest vessel in same SoI as the current vessel.

If the vessel is alreadying targeting a vessel in the same SoI, the next closest one will be targeted, instead. If the current target is the closest vessel, the most distant one is selected.

fc.TargetOrbitSpeed()

Returns: Current orbital speed of the target, or 0.

Returns the orbital speed of the current target, in m/s. If there is no target, returns 0.

fc.TargetPeriapsis()

Returns: Target's Pe in meters, or 0 if there is no target.

Returns the target's periapsis.

fc.TargetRelativeInclination()

Returns: Inclination in degrees. Returns 0 if there is no target, or the target orbits a different celestial body.

Returns the relative inclination between the vessel and the target.

fc.TargetSameSoI()

Returns: 1 if the target is in the same SoI; 0 if not, or if there is no target.

Returns 1 if there is a target, and it is in the same SoI as the vessel (for example: both orbiting Kerbin, or both orbiting the Mun, but not one orbiting Kerbin, and the other orbiting the Mun).

fc.TargetSituation()

Returns: A number between -1 and 7 (inclusive).

Returns the target's situation, based on the KSP variable:

  • -1 - INVALID (no target)
  • 0 - LANDED
  • 1 - SPLASHED
  • 2 - PRELAUNCH
  • 3 - FLYING
  • 4 - SUB_ORBITAL
  • 5 - ORBITING
  • 6 - ESCAPING
  • 7 - DOCKED

For some Celestial Body target types, the situation is always 5 (ORBITING).

fc.TargetSMA()

Returns: SMA in meters, or 0 if there is no target.

Returns the semi-major axis of the target's orbit.

fc.TargetTimeToAp()

Returns: Time to Ap in seconds, or 0 if there's no target.

Returns the time until the target's next apoapsis.

fc.TargetTimeToPe()

Returns: Time to Pe in seconds, or 0 if there's no target.

Returns the time until the target's next periapsis.

fc.TargetType()

Returns: A number between 0 and 5 (inclusive)

Returns a number identifying the target type. Valid results are:

  • 0: No target
  • 1: Target is a Vessel
  • 2: Target is a Docking Port
  • 3: Target is a Celestial Body
  • 4: Target is a Waypoint
  • 5: Target is an asteroid

fc.TargetTypeId()

Returns: A value between 1 and 13 inclusive for a vessel-type target, or 14 for a Celestial Body, or 0 for no target, or another target type.

Returns a number representing the target vessel type (eg, 1 = Ship, etc).

  • 0 - Invalid (not one of the below types)
  • 1 - Ship
  • 2 - Plane
  • 3 - Probe
  • 4 - Lander
  • 5 - Station
  • 6 - Relay
  • 7 - Rover
  • 8 - Base
  • 9 - EVA
  • 10 - Flag
  • 11 - Debris
  • 12 - Space Object
  • 13 - Unknown
  • 14 - Celestial Body

fc.TargetVelocityX()

Returns: Velocity in m/s. Positive means the vessel is moving 'right' relative to the target, and negative means 'left'.

Returns the target's velocity relative to the left-right axis of the vessel.

fc.TargetVelocityY()

Returns: Velocity in m/s. Positive means the vessel is moving 'up' relative to the target, negative means relative 'down'.

Returns the target's velocity relative to the top-bottom axis of the vessel (the top / bottom of the vessel from the typical inline IVA's perspective).

fc.TargetVelocityZ()

Returns: Velocity in m/s. Positive means approaching, negative means departing.

Returns the target's velocity relative to the forward-aft axis of the vessel (the nose of an aircraft, the 'top' of a vertically-launched craft).

fc.TargetVesselCount()

Returns: The number of other non-debris vessels, or 0 if there are none.

Returns the number of other non-debris vessels in the current SoI. This count includes landed vessels as well as vessels in flight, but it does not count the current vessel.

fc.TargetVesselDistance(double id)

  • id: The id number of the desired vessel.

Returns: Distance to the target in meters, or 0.

Returns the distance to the non-debris target selected by id. Distance is in meters. The id parameter must be between 0 and fc.TargetVesselCount() - 1.

fc.TargetVesselName(double id)

  • id: The id number of the desired vessel.

Returns: The name of the selected vessel, or an empty string if no valid vessel was selected.

Returns the name of the non-debris vessel selected by id. The id parameter must be between 0 and fc.TargetVesselCount() - 1.

fc.TargetVesselType()

Returns: Name of the target vessel type, or an empty string if there is no target, or the target is not a vessel.

Returns the name of the target vessel type (eg, "Ship", "Plane", "Station", etc).

fc.ToggleTargetFilter(double vesselType)

  • vesselType: An integer value between 1 and 13, inclusive.

Returns: 1 if the vesselType was cleared, 0 if it was not.

Toggles the specified vesselType in the target tracking filter. vesselType must be one of:

  • 1 - Ship
  • 2 - Plane
  • 3 - Probe
  • 4 - Lander
  • 5 - Station
  • 6 - Relay
  • 7 - Rover
  • 8 - Base
  • 9 - EVA
  • 10 - Flag
  • 11 - Debris
  • 12 - Space Object
  • 13 - Unknown

Returns 1 if the provided vesselType was previously set, or 0 if it was not set or an invalid vesselType was supplied.


Thermal Category

The Thermal section contains temperature monitoring values.

fc.AmbientTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Ambient temperature in Kelvin or Celsius.

Returns the current atmosphere / ambient temperature outside the craft.

fc.ExternalTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: External temperature in Kelvin or Celsius.

Returns the current temperature outside the vessel.

fc.HottestEngineTemperatureSign()

Returns: -1 if the temperature is cooling, +1 if it is increasing, +0 if it is stable or no heat shields are installed.

Returns the direction of temperature change of the hottest engine.

fc.HottestEngineTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Current temperature of the hottest engine in Kelvin or Celsius.

Returns the current temperature of the hottest engine, where hottest engine is defined as "closest to its maximum temperature".

fc.HottestEngineMaxTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Current temperature of the hottest engine in Kelvin or Celsius.

Returns the maximum temperature of the hottest engine, where hottest engine is defined as "closest to its maximum temperature".

fc.HeatShieldMaxTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Heat shield maximum temperature in Kelvin or Celsius, or 0 if no heatshields are installed.

Returns the maximum temperature of the hottest heat shield.

fc.HeatShieldTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Heat shield temperature in Kelvin or Celsius, or 0 if no heatshields are installed.

Returns the current temperature of the hottest heat shield.

fc.HeatShieldTemperatureSign()

Returns: -1 if the temperature is cooling, +1 if it is increasing, +0 if it is stable or no heat shields are installed.

Returns the direction of temperature change of the hottest heat shield.

fc.HottestPartMaxTemperature(bool useKelvin)

  • useKelvin: When true, returns the temperature in units of Kelvin; when false, Celsius is used.

Returns: The current hottest part's maximum temperature, in degrees Celsius or Kelvin.

Returns the maximum temperature of the current hottest part.

fc.HottestPartSign()

Returns: -1 if the temperature is cooling, +1 if it is increasing, +0 if it is stable.

Returns the direction of temperature change of the hottest part.

fc.HottestPartTemperature(bool useKelvin)

  • useKelvin: When true, returns the temperature in units of Kelvin; when false, Celsius is used.

Returns: The current hottest part's temperature, in degrees Celsius or Kelvin.

Returns the hottest part on the vessel (the part closest to its thermal limit).

fc.InternalMaxTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Maximum temperature of the interior of the current IVA pod in Kelvin or Celsius.

Returns the maximum interior temperature of the current IVA pod.

fc.InternalTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Current temperature of the interior of the current IVA pod in Kelvin or Celsius.

Returns the interior temperature of the current IVA pod.

fc.InternalTemperatureSign()

Returns: -1 if the temperature is cooling, +1 if it is increasing, +0 if it is stable.

Returns the direction of the temperature change in the pod interior.

fc.PodMaxTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Maximum temperature of the skin of the current IVA pod in Kelvin or Celsius.

Returns the maximum skin temperature of the current IVA pod.

fc.PodTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Current temperature of the skin of the current IVA pod in Kelvin or Celsius.

Returns the skin temperature of the current IVA pod.

fc.PodTemperatureSign()

Returns: -1 if the temperature is cooling, +1 if it is increasing, +0 if it is stable.

Returns the direction of the temperature change on the pod skin.

fc.RadiatorActive()

Returns: 1 if any radiators are active, or 0 if no radiators are active or no radiators are installed.

Returns 1 if there is at least one radiator active on the vessel.

fc.RadiatorCount()

Returns the number of radiators installed on the craft, regardless of their status (enabled / disabled / damaged).

fc.RadiatorDamaged()

Returns 1 if any deployable radiators are damaged.

fc.RadiatorDeployable()

Returns: 1 if any radiators may be deployed, or 0 if no radiators may be deployed or no radiators are installed.

Returns 1 if at least one radiator may be deployed.

fc.RadiatorInactive()

Returns: 1 if any radiators are inactive, or 0 if no radiators are inactive or no radiators are installed.

Returns 1 if there is at least one radiator inactive on the vessel.

fc.RadiatorMoving()

Returns: 1 if a deployable radiator is moving, or 0 if none are moving.

Returns 1 if at least one radiator on the vessel is deploying or retracting.

fc.RadiatorPosition()

Returns: A number between 0 and 1 as described in the summary.

Returns a number representing the average position of undamaged deployable radiators.

  • 0 - No radiators, no undamaged radiators, or all undamaged radiators are retracted.
  • 1 - All deployable radiators extended.

If the radiators are moving, a number between 0 and 1 is returned.

fc.RadiatorRetractable()

Returns: 1 if a deployable radiator may be retracted, or 0 if none may be retracted or no deployable radiators are installed.

Returns 1 if at least one radiator on the vessel may be retracted or undeployed.

fc.RadiatorUtilization()

Returns: Current utilization, in the range of 0 to 1. If no active radiators are installed, or none are active, returns 0.

Returns current radiator utilization as a percentage of maximum of active radiators.

fc.SetRadiator(bool deploy)

  • deploy: 'true' to deploy radiators, 'false' to undeploy radiators.

Returns: 1 if any radiators are now deploying or retracting.

Deploys deployable radiators, or retracts retractable radiators.

fc.SkinTemperature(bool useKelvin)

  • useKelvin: If true, the temperature is returned in Kelvin; if false, the temperature is in Celsius.

Returns: Current temperature of the interior of the current IVA pod in Kelvin or Celsius.

Returns the skin temperature of the current IVA pod.

fc.ToggleRadiator()

Returns: 1 if any deployable radiators are installed. 0 otherwise.

Deploys deployable radiators, or retracts retractable radiators.


Time Category

The Time section provides access to the various timers in MAS (and KSP).

fc.HourOfDay(double time)

  • time: Time in seconds (eg, fc.UT()).

Returns: The hour of the day, accounting for Kerbin time vs. Earth time.

Returns the hour of the day (0-5.999... using the Kerbin clock, 0-23.999... using the Earth clock). Fraction of the hour is retained.

fc.MET()

Returns: Mission time, in seconds.

Fetch the current MET (Mission Elapsed Time) for the vessel in seconds.

fc.MinutesOfHour(double time)

  • time: Time in seconds (eg, fc.MET()).

Returns: A number representing the minutes in the hour in the range [0, 60).

Given a standard time in seconds, return the minutes of the hour (a number from 0 to 60). Fractions of a minute are retained and negative values are converted to positive.

fc.SecondsOfMinute(double time)

  • time: Time in seconds (eg, fc.MET()).

Returns: A number representing the seconds in the minute in the range [0, 60).

Given a standard time in seconds, return the seconds of the minute (the number from 0 to 60). Fractions of a second are retained and negative values are converted to positive.

fc.TimeOfDay(double time)

Returns: Number of seconds since the latest day began.

Similar to fc.HourOfDay(), but returning the answer in seconds instead of hours.

When used with fc.UT(), for instance, it returns the number of seconds since midnight UT.

fc.TimeToAltitude(double altitude)

  • altitude: Altitude above the datum, in meters.

Returns: Time in seconds until the altitude is crossed, or 0 if the orbit does not cross that altitude.

Given an altitude in meters, return the number of seconds until the vessel next crosses that altitude. If the vessel is on a hyperbolic orbit, or if the orbit never crosses the given altitude, return 0.0.

fc.TimeToANEq()

Returns: Time to AN, seconds, or 0 if the orbit is hyperbolic.

For non-hyperbolic orbits, returns time to the next equatorial Ascending Node.

fc.TimeToANTarget()

Returns: Time in seconds to the next ascending node, in seconds, or 0.

Returns the time until the next ascending node with the current target, provided the target is orbiting the same body as the vessel (and the target exists).

fc.TimeToAp()

Returns: Time until Ap in seconds, or 0 if the time would be invalid.

Fetch the time to the next apoapsis. If the orbit is hyperbolic, or the vessel is not flying, return 0.

fc.TimeToAtmosphere()

Returns: Time until the atmosphere boundary is crossed, in seconds; 0 for invalid times.

Fetch the time until the vessel's orbit next enters or exits the body's atmosphere. If there is no atmosphere, or the orbit does not cross that threshold, return 0.

fc.TimeToDNEq()

Returns: Time in seconds to the next descending node, or 0 if the orbit is hyperbolic.

Returns the time to the equatorial descending node, in seconds.

fc.TimeToDNTarget()

Returns: Time in seconds to the next descending node, in seconds, or 0.

Returns the time until the next descending node with the current target, provided the target is orbiting the same body as the vessel (and the target exists).

fc.TimeToLanding()

Returns: Time in seconds until landing; 0 for invalid times.

Required Mod(s): MechJeb

Returns the time until the vessel lands. If MechJeb is available and the landing prediction module is enabled, MechJeb's results are used.

If the MechJeb is not available, the fallback estimator assumes the surface is at sea level and there is no atmosphere, so this result will be inaccurate when the point of impact is at a higher altitude, or there is an atmosphere.

If the orbit does not intercept the surface, 0 is returned.

fc.TimeToPe()

Returns: Time until the next Pe in seconds, or 0 if the time would be invalid. May return a negative number in hyperbolic orbits.

Fetch the time to the next periapsis. If the vessel is not flying, the value will be zero. If the vessel is on a hyperbolic orbit, and it has passed the periapsis already, the value will be negative.

fc.TimeToSoI()

Returns: Time until transition in seconds; 0 if the orbit does not cross a Sphere of Influence.

Returns the number of seconds until the vessel's orbit transitions to another sphere of influence (leaving the current one and entering another).

fc.UT()

Returns: Universal Time, in seconds.

Fetch the current UT (universal time) in seconds.

fc.WarpRate()

Returns: 1 for normal speed, larger values for various warps.

Returns the current time warp multiplier.


Trim Category

The Trim section provides control over aircraft trim settings.

fc.GetPitchTrim()

Returns: Current pitch trim, in the range [-1, 1].

Returns the current pitch trim.

fc.GetRollTrim()

Returns: Current roll trim, in the range [-1, 1].

Returns the current roll trim.

fc.GetYawTrim()

Returns: Current yaw trim, in the range [-1, 1].

Returns the current yaw trim.

fc.SetPitchTrim(double pitchTrim)

  • pitchTrim: The new pitch trim, in the range [-1, 1]

Returns: Updated pitch trim, in the range [-1, 1].

Returns the current pitch trim.

fc.SetRollTrim(double rollTrim)

  • rollTrim: The new roll trim, in the range [-1, 1]

Returns: Updated roll trim, in the range [-1, 1].

Returns the current roll trim.

fc.SetYawTrim(double yawTrim)

  • yawTrim: The new yaw trim, in the range [-1, 1]

Returns: Updated yaw trim, in the range [-1, 1].

Returns the current yaw trim.

fc.SetTrim(double yawTrim, double pitchTrim, double rollTrim)

  • yawTrim: The new yaw trim, in the range [-1, 1]
  • pitchTrim: The new pitch trim, in the range [-1, 1]
  • rollTrim: The new roll trim, in the range [-1, 1]

Returns: Always returns 1.

Update all trim settings at once.


Unassigned Region Category

Variables that have not been assigned to a different category are dumped in this region until I figured out where to put them.

fc.Remap(double value, double bound1, double bound2, double map1, double map2)

  • value: An input number
  • bound1: One of the two bounds of the source range.
  • bound2: The other bound of the source range.
  • map1: The first value of the destination range.
  • map2: The second value of the destination range.

Remaps value from the range [bound1, bound2] to the range [map1, map2].

The order of the bound and map parameters will be interpreted correctly. For instance, fc.Remap(var, 1, 0, 0, 1) will have the same effect as 1 - var.

fc.Select(bool condition, object trueValue, object falseValue)

  • condition: The condition that selects the value.
  • trueValue: The value returned when condition is true.
  • falseValue: The value returned when condition is false.

Returns: One of trueValue or falseValue.

Returns trueValue when condition is true, otherwise returns falseValue.

trueValue and falseValue may be numbers or strings. They do not have to be the same type.

condition must be a boolean value. For example, fc.GetActionGroup(0) returns a number. To make it a boolean, you would need to use fc.GetActionGroup(0) == 1.

fc.Select(double condition, object negativeValue, object zeroValue, object positiveValue)

  • condition: A numeric value that selects the response.
  • negativeValue: The value returned when condition is less than zero.
  • zeroValue: The value returned when condition is exactly zero.
  • positiveValue: The value returned when condition is greater than zero.

Returns: One of negativeValue, zeroValue, or positiveValue.

Select one of three values, depending on the value of condition.

If condition is less than zero, negativeValue is returned. If condition is exactly zero, zeroValue is returned. If condition is positive, positiveValue is returned.

negativeValue, zeroValue, and positiveValue may be numbers or strings. They do not have to be all numbers or all strings.

Remember that numeric precision may may it difficult for equations to return exactly zero.

fc.SendSoftkey(string monitorName, double softkeyNumber)

  • monitorName: The name of the monitor.
  • softkeyNumber: The softkey code to send.

Returns: 1 if the code was processed, 0 otherwise.

Send a softkey event to the named monitor. A softkey is a numeric integer code that may be interpreted by the active page on that monitor, or it may be forwarded to the components of that page (such as an RPM_MODULE node).


Vessel Info Category

The Vessel Info group contains non-flight information about the vessel (such as vessel name, type, etc.).

fc.VesselName()

Returns the name of the vessel.

fc.VesselType()

Returns a string naming the type of vessel.

fc.VesselTypeId()

Returns: A value between 1 and 13 inclusive for a vessel, or 14 for a Celestial Body, or 0 another target type.

Returns a number representing the vessel type (eg, 1 = Ship, etc).

  • 0 - Invalid (not one of the below types)
  • 1 - Ship
  • 2 - Plane
  • 3 - Probe
  • 4 - Lander
  • 5 - Station
  • 6 - Relay
  • 7 - Rover
  • 8 - Base
  • 9 - EVA
  • 10 - Flag
  • 11 - Debris
  • 12 - Space Object
  • 13 - Unknown
  • 14 - Celestial Body

This documentation was automatically generated from source code at 22:17 UTC on 2/Jan/2019.

Clone this wiki locally