MASComponent - MOARdV/AvionicsSystems GitHub Wiki

The MASComponent module is the main functional block of Avionics Systems. By itself, the MASComponent does nothing useful, but it is composed of multiple MASAction objects, each of which is defined in the MASAction's config block.

Each MASComponent may have a startupScript specified. When present, MAS will execute this script when the vessel is loaded (for instance, switching to the vessel, or launching the vessel). This script will be executed each time the vessel is loaded, so it can be used to initialize important variables, or to check the state of the vessel or important values.

All MASAction config blocks include a 'name' field. This is an /optional/ field that can be used to name the block, so if there is a configuration error, the output log will contain a name to help identify the problem. It can potentially allow Module Manager scripts to edit the config, as well. You are not required to include a name.

Setup:

MODULE
{
  name = MASComponent

  //startupScript = MyStartup()

  // one or more MASAction actions as described below
}
  • startupScript: Optional. Allows the prop designer to specify a script that is executed while MAS configures the prop.

CAUTION: Only use one MASComponent per prop. Multiple MASComponent modules will lead to incorrect behavior.

Modes:

Many of the MASAction objects may operate in several modes.

Static Mode: Static mode does not use a variable. It is used to make a one-time change to a value at initialization, which is useful for techniques such as texture atlasing and color shifting.

Boolean Mode: In boolean mode, the variable is assumed to be either true or false. Since all variables in MAS are a number or string, this means that strings are always treated as 'false'. Numbers are treated as 'true' if they are greater than 0 and 'false' if they are equal to or less than zero. This mode is good for simple animated switches and actions (illuminating backlights or signal flags, for instance).

Blend Mode: In blend mode, the variable is treated as a value between 0 and 1, allowing finer control of the behavior (such as dimmable lights).

MASAction Objects

The MASAction objects are summarized here, and described below in full detail.

  • ANIMATION - Allows an animation to be set at a specific time.
  • ANIMATION_PLAYER - Plays an animation from beginning to end, or end to beginning, depending on the speed. Animations may also be looped.
  • AUDIO_PLAYER - Plays an audio clip when triggered
  • COLLIDER_ADVANCED - A collider than can provide the coordinates of where a click happened. This collider is primarily intended for touch screens, but may have other applications.
  • COLLIDER_EVENT - A basic collider than can activate actions when clicked, released, or dragged.
  • COLOR_SHIFT - Changes the color of a specified transform. Supports hard-coded color values or dynamic color values.
  • INT_LIGHT - Used to control Unity Light components attached to the IVA model. Color and brightness can be changed.
  • INTERNAL_TEXT - This object is used solely to add text to the stock KSP ledPanelSpeed prop. It should not be used otherwise.
  • MODEL_SCALE - Changes the scaling of part of a prop.
  • ROTATION - Rotates part of a prop.
  • TEXT_LABEL - Very configurable text rendering system.
  • TEXTURE_REPLACEMENT - Replaces the texture at a spot on a transform with a different texture, such as a flag decal.
  • TEXTURE_SCALE - Changes the UV scaling of a texture.
  • TEXTURE_SHIFT - Adds a bias value to the UV components of a texture.
  • TRANSLATION - Translates (moves) part of a prop.
  • TRIGGER_EVENT - Automatically activates an event when the specified conditions are met.

ANIMATION

This node is used to control an animation by specifying where along the animation the playback should be paused, as opposed to the ANIMATION_PLAYER, below, which displays an animation from beginning to end (or reversed) when a condition is met.

ANIMATION
{
	name = ALT/RANGE tape animation
	animation = AltRangeScaleAnim
	//externalAnimation = MyPartAnimation
	variable = fc.Conditioned(ARRT_Range() * 0.0002)
	speed = 1
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • animation: Optional. Required if 'externalAnimation' is not present. The name of the animation on the prop that is controlled by the variable.
  • externalAnimation: Optional. Ignored if 'animation' is present. The name of an animation on the part the prop is in that is controlled by the variable.
  • speed: Optional. Default 0.0. Indicates the maximum amount the animation can change per second. 0.0 indicates instantaneous change. 1.0 means the animation requires one second to play back, 2.0 means 1/2 second, etc.
  • variable: Required. The name of the variable script to evaluate. Values less than 0 are treated as 0, and values greater than 1 are treated as 1. ANIMATION nodes are always treated as Blend Mode.

ANIMATION_PLAYER

This action plays an animation in response to the state of a variable. It also provides control of the animation playback speed. It can operate in Boolean Mode and Threshold Mode. The animation player may be configured to play the entire clip from beginning to end, or to start or stop a continuously-looped animation, as opposed to the ANIMATION node, above, which can controls where in the playback the animation will display.

When loop is set to true, the animation will be looped as long as the variable in variable evaluates to true. The animation may still be stopped by setting animationSpeed to false. When loop is set to false, or omitted, the animation will play from beginning to end when variable evaluates to true, and from end to beginning when variable becomes false.

ANIMATION_PLAYER
{
  name = swToggle
  animation = SwitchTumbleAnim
  //externalAnimation = MyPartAnimation
  //animationSpeed = 1.0
  //loop = false
  variable = fc.GetRCS()
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • animation: Optional. Required if 'externalAnimation' is not present. The name of the animation on the prop that is controlled by the variable.
  • externalAnimation: Optional. Ignored if 'animation' is present. The name of an animation on the part the prop is in that is controlled by the variable.
  • animationSpeed: Optional. Default 1.0. Used to adjust animation playback rate. May be either a constant number or a variable.
  • loop: Optional. Default 'false'. When true, the specified animation will loop continuously until 'variable' becomes false.
  • variable: Required. The name of the variable script to evaluate.

AUDIO_PLAYER

This action plays audio when a variable transitions into or out of a specified range. This action can operate in Boolean Mode or Threshold Mode.

The audio can be configured to play in one of four modes:

  • ON: Play the audio clip once when the variable goes true / in range.
  • OFF: Play the audio clip once when the variable goes false / out of range.
  • BOTH: Play the audio clip once for any transition (going true or going false).
  • LOOP: Loop the audio as long as the variable is true / in range.
AUDIO_PLAYER
{
	name = Clicker
	sound = ASET/ASET_Props/Sounds/tumbleClick01
	//variableSound = fc.GetPersistent("VaryingAudioSelector")
	//variableSound = "ASET/ASET_Props/Sounds/tumbleClick01"
	//volume = 1.0
	trigger = BOTH
	variable = fc.GetPersistent("Backlight")
	//mustPlayOnce = false
	//pitch = fc.AtmosphereDepth()
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • sound: Optional. Required if variableSound is not used. The URI to the audio clip to play.
  • variableSound: Optional. Ignored if sound is present. A variable to select the audio clip to play. The variable must return a string containing a URI. String literals used for variableSound must be encased in quotation marks, as the second example above shows. Allows the same audio player to switch between multiple different audio clips.
  • volume: Optional. Default 1.0. The volume at which the audio should be played (a range between 0 and 1). May use either a variable or a constant number.
  • trigger: Required. The conditions under which the audio is played, as explained in the text above.
  • variable: Required. The name of the variable script to evaluate.
  • mustPlayOnce: Optional. When true, the audio clip will be played completely, even if the controlling variable goes out of range. Not valid with trigger = LOOP.
  • pitch: Optional. Default 1.0. The pitch for the audio playback. May be a variable or a constant number.

COLLIDER_ADVANCED

An Advanced Collider action is used to respond to button presses and releases. Where the COLLIDER_EVENT (see below) reports simple click/release (and rudimentary click-and-drag) events, the Advanced Collider provides the coordinates within the collider that were hit. This feature is designed for supporting Touch Screen MFD emulation within a MAS IVA, although it can be used for any touch-enabled device (including mechanical sliders). Only BoxColliders are supported for COLLIDER_ADVANCED.

Because the Unity Collider may not be oriented the same way as the coordinate system of the prop, the Advanced Collider provides configuration options to report the normalized coordinates of each hit it detects, as well as functions that may be applied to the Unity Collider coordinates to convert them to screen space coordinates.

The logHits option, when set to true, will report the X, Y, and Z coordinates of each click that intersects the collider, as well as the X and Y coordinates after conversion. The X, Y, and Z coordinates are normalized coordinates, meaning each number ranges between 0 and 1. These messages are written to the KSP.log - search for "Normalized click at" or "AdvancedButtonObject". Note that MAS Verbose Logging must be enabled (accessible from the MAS configuration app on the Space Centre scene).

To convert the Unity Collider coordinates into values used by the touch screen MFD, equations must be defined for clickX and clickY. These equations tell MAS how to convert normalized coordinates to X and Y coordinates for the click location on the MFD. These equations use the special keywords %X%, %Y%, and %Z% to represent the three values of the normalized coordinate. For instance,

  clickX = %X%
  clickY = %Y%

will send the X and Y values that are reported when logHits is true, unchanged. These values are not the most convenient to work with with an MFD, so it is usually a good idea to convert the values into screen coordinates.

  clickX = %X% * 1024
  clickY = %Z% * 1024

converts the normalized X coordinate to a value between 0 and 1024 for the X hit location, and it converts the normalized Z coordinate to a value between 0 and 1024 for the Y hit location.

The Advanced Collider may be configured to work with an MFD by setting the monitorID field. In this mode, all touch, drag, and release events are routed to the monitor to be used with the hitbox fields in the currently-active page. Alternatively, the advanced collider may be used on a non-MFD prop to trigger actions with a parameter based on the hit location. For instance, a slider prop could be positioned depending on where in the collider the prop was clicked.

To use the Advanced Collider in MFD mode, include the monitorID field. In MFD mode, the onClick, onDrag, and onRelease fields are ignored. To use the Advanced Collider directly, do not include monitorID. Instead, include at least one of onClick, onDrag, or onRelease.

For more information on how to use this component to create a touch screen display, refer to Touch Screens.

COLLIDER_ADVANCED
{
  name = TouchScreen Collider
  collider = pb_Collider
  monitorID = %AUTOID%
  //onClick = 
  //onDrag = 
  //onRelease = 
  clickX = %X% * 1024
  clickY = %Z% * 1024
  //sound = 
  //volume = 
  //variable = 
  //logHits =
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • collider: Required. The transform in the prop that contains a collider.
  • monitorID: Optional (see above). The monitorID of the monitor that will receive clicks. Since the current implementation of Advanced Colliders is coupled to touchscreen monitors, MAS assumes that this component is part of the monitor's MASComponent module.
  • onClick: Optional (see above). The action to invoke when the advanced collider is clicked.
  • onDrag: Optional (see above). The action to invoke when the mouse is clicked and dragged within the advanced collider.
  • onRelease: Optional (see above). The action to invoke when the mouse is released after clicking within the advanced collider.
  • clickX: Required. The equation used to convert the Unity collider's hit location into the X coordinate used by the MASpage.
  • clickY: Required. The equation used to convert the Unity collider's hit location into the Y coordinate used by the MASpage.
  • sound: Optional. Required if 'volume' is present. When present, plays the specified audio when the click event fires.
  • volume: Optional. Default 1.0. Adjusts the volume of the click sound.
  • variable: Optional. When a 'variable' is used, the collider is only processed when the variable is 'true' (greater than 0). If no 'variable' is defined, the collider always works.
  • logHits: Optional. Default false. When true, and Verbose Logging is enabled for MAS, each click on this collider is recorded to KSP.log with the normalized coordinates of the hit location.

COLLIDER_EVENT

A Collider Event action is used to respond to button presses and releases. The Collider may use a variable to disable it.

Each Collider must include one of 'onClick', 'onRelease', 'onDragX', or 'onDragY'. It may include any combination of these event handlers (it may even include all four).

'onClick' is triggered when the player clicks on the collider. If 'autoRepeat' is included, the 'onClick' event is triggered every time the 'autoRepeat' timer expires, until the mouse button is released.

'onRelease' is triggered when the player releases the mouse button after clicking on the collider. When used with the 'onClick' event to control an animation, the two events can be used to simulate a momentary-contact button or switch.

'onDragX' is triggered when the mouse is moved to the left or right after the collider has been clicked. It stops executing when the mouse button is released.

'onDragY' works like 'onDragX', but it tracks the vertical motion of the mouse, instead.

When both 'onDragX' and 'onDragY' are present and the 'singleAxisDrag' parameter is present, only one of the drag events will be generated when the mouse moves. If the mouse drag initially moves horizontally more than vertically, only 'onDragX' will be reported. If the mouse drag moves more vertically, only 'onDragY' will be reported. Which event is generated is reset each time the mouse clicks on the collider.

Both 'onDragX' and 'onDragY' may use the keyword %DRAG%. This keyword reports the amount that the mouse has moved on the selected axis. This amount is always between -1 and +1. 'onDragX' reports positive values when the mouse moves right, and 'onDragY' reports positive values when the mouse moves up. For example, 'onDragX' in the example below will cause the "Backlight" persistent to increase when the mouse is dragged to the right, and decrease when it is dragged left.

COLLIDER_EVENT
{
  name = Toggle switch
  collider = SwitchColider
  onClick = fc.ToggleRCS()
  //onRelease = fc.ToggleRCS()
  //autoRepeat = 0.1
  //onDragX = fc.AddPersistentClamped("Backlight", %DRAG%, 0, 1)
  //onDragY = 
  //dragSensitivity =
  //singleAxisDrag =
  //sound = 
  //volume = 
  //variable = 
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • collider: Required. The transform in the prop that contains a collider.
  • onClick: Optional. Function that is triggered when the collider is clicked.
  • onRelease: Optional. Function that is triggered when the collider is released.
  • onDragX: Optional. Function that is called when the collider is clicked and the mouse is moved to the left or right.
  • onDragY: Optional. Function that is called when the collider is clicked and the mouse is moved up or down.
  • autoRepeat: Optional. Default 0.0. When set to a positive number, the 'onClick' event triggers every 'autoRepeat' seconds until the button is released. Ignored if 'onClick' is not present.
  • dragSensitivity: Optional. Default 1.0. Controls the magnitude of the update value in the drag event callbacks. Ignored if neither 'onDragX' nor 'onDragY' is present.
  • singleAxisDrag: Optional. Default false. Ignored if either 'onDragX' or 'onDragY' is missing. When 'true', only one of onDragX or onDragY will execute while the mouse is being dragged.
  • sound: Optional. Required if 'volume' is present. When present, plays the specified audio when the click event fires.
  • volume: Optional. Default 1.0. Adjusts the volume of the click sound.
  • variable: Optional. When a 'variable' is used, the collider is only processed when the variable is 'true' (greater than 0). If no 'variable' is defined, the collider always works.

COLOR_SHIFT

A Color Shift action is used to change the color of part of the prop in response to a controlling variable. Like an animation player, this control can be used in Boolean Mode. However, unlike the animation player, the Color Shift can be configured to blend between the two colors using Blend Mode, and it supports Static Mode. In this case, the value is interpolated between the first and second values of the range, and the resulting value is used to blend between the two color settings.

COLOR_SHIFT
{
    name = Glow Border and Switch
    transform = GlowBorder, SwitchMarker
    passiveColor = 0,0,0,255
    activeColor = COLOR_MOARdV_BacklightColor
    variable = fc.GetRCS()
    //blend = true
    //flashRate = 0.5
    //colorName = _EmissiveColor
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The name of a transform or a comma-separated list of transforms whose color will be shifted.
  • passiveColor: Required. The RGBA quadruplet or RasterPropMonitor-compatible Named Color to use when the variable is out of bounds.
  • activeColor: Optional. Required if variable, blend, or flashRate is included. The RGBA quadruplet or RasterPropMonitor-compatible Named Color to use when the variable is in bounds.
  • variable: Optional. Required if activeColor is included. The name of the variable script to evaluate.
  • blend: Optional. Default false. When true, the color is linearly interpolated between passiveColor and activeColor.
  • flashRate: Optional. Default 0.0. Ignored if 'blend' is enabled. Specifies one-half of the duty cycle for a blinking light (in other words, a flashRate of 0.5 means the light is on 0.5 seconds, and then off for 0.5 seconds).
  • colorName: Optional. Default '_EmissiveColor'. Controls which color this Color Shift action will alter. Known working values are '_Color' (diffuse) and '_EmissiveColor'.

An alternate mode for COLOR_SHIFT is a one-time color change. If 'variable' is omitted, the 'passiveColor' is applied one time at startup, but the component has no further effect. This is useful for changing the color of a component without needing it to change in the future (such as re-tinting a prop). When used for this mode, do not include any optional parameters ('blend' or 'flashRate') or configuration errors will occur.

INT_LIGHT

This action is used to control interior lights. The color and intensity of the light may be changed from what is embedded in the IVA model using this component.

INT_LIGHT
{
  name = Mk1 Cockpit
  lightName = Point light
  //color = 255, 255, 255, 255
  //intensity = 1
  variable = fc.GetPersistent("Interior Lights")
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • lightName: Optional. The name or names of the lights to control. Multiple light transforms may be listed, as long as they are separated by commas (eg, lightName = Point light, PointLight, SpotLight). If lightName is omitted, all interior lights are controlled.
  • color: Optional. When present, the interior light colors are set to this value. Note that the R, G, B, and A color values may be variable.
  • intensity: Optional. When present, the intensity of the interior light may be changed using a variable for this field. MAS clamps the values to between 0 and 8 (although 1 is probably a good maximum).
  • variable: Required. The name of the variable script to evaluate.

INTERNAL_TEXT

This component is used to create KSP InternalText objects on the stock prop found in Squad/Props/ledPanelSpeed, which is used to display vessel speed in stock IVAs. It is an extremely limited text renderer, since there is minimal documentation on how to interact with the InternalText objects. As such, unless making props using the ledPanelSpeed model, prop makers should always use TEXT_LABEL.

INTERNAL_TEXT
{
  name = Stock LED Panel text
  transform = textLabel
  passiveColor = 255, 255, 255, 255
  text = Fuel: <=0:P0=> $#$ fc.PropellantPercent()
}
  • name: Optional. Default '(anonymous)'. A name for the internal text node.
  • transform: Required. The transform to which the internal text object will be attached.
  • passiveColor: Required. The color of the text. At present, INTERNAL_TEXT does not support color changing, so only numbers are accepted for passiveColor.
  • text: Required. The text that will be displayed. INTERNAL_TEXT supports a single line of text.

MODEL_SCALE

This action is used to scale a transform (and its children). It supports Boolean Mode, Threshold Mode, and Blend Mode.

MODEL_SCALE
{
	name = Warning Plate Cover
	transform = CoverLoc
	startScale = 0, 0, 0
	endScale = 0, 0, -0.9
	variable = fc.GetRCS()
	//blend = true
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The name of the transform that will be scaled.
  • startScale: Required. A Vector3 showing how much should be added to the transform's scale when the variable is out of range.
  • endScale: Required. A Vec3 showing how much should be added to the transform's scale when the variable is in range.
  • variable: Required. The name of the variable script to evaluate.
  • blend: Optional. Default false. When true, the transform is linearly interpolated between startScale and endScale based on where in the range the variable falls.

ROTATION

The Rotation action is used to rotate part of a prop. This feature is useful for indicator needles and dial gauges. Rotations may be Static (single rotation during initialization), Boolean, Threshold, or Blended.

When in Blended Mode, Rotations can have their movement limited by 'speed', which indicates how many seconds the animation should require to cycle from startRotation to endRotation. This capability may be used to simulate mechanical limitations of instruments, for instance.

In addition, if 'longPath' is set to true, the rotation will take the longer of the two direct routes between 'startRotation' and 'endRotation'. This option allows for instruments where a needle rotates more than 180 degrees from its start position to its end position. 'longPath' applies only in Blended Mode.

One last feature of Blend Mode rotations is the option to specify a 'modulo'. When defined, the variable is modulated by the 'modulo' value, which allows rotating needles (such as altimeters or clocks) to rotate around a face multiple times, but return to the zero position without having to "unwind" back to it. For instance, if an altimeter is configured with a range of 0 to 100000 meters, the "hundreds" needle has to circle the gauge 100 times to go from the minimum value to the maximum value. If the altimeter is configured so it resets to zero outside the atmosphere, the "hundreds" hand would circle dozens of times to reach the zero position.

TODO: better explanation - that's still murky.

Note that if endRotation indicates a rotation greater than 360 degrees, the rotation very likely will not display correctly. A large rotation (where the object being rotated can go around in a circle repeatedly, like an altimeter or clock) should be represented by using and endRotation of 360, longPath = true, modulo, blend, and range.

ROTATION
{
	name = Right Arrow
	transform = ArrowRightLoc
	startRotation = 0,0,0
	endRotation = -43.57964,0,0
	variable = fc.GetThrottle()
	range = 0.0, 1.0
	blend = true
	//longPath = true
	//modulo = 1000
	//speed = 1.0
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The name of the transforms that contain lights.
  • startRotation: Required. The Euler angles of the initial rotation position. This value is used for Static mode, as well as the other modes for values out of range.
  • endRotation: Required. The Euler angles of the final rotation position. This value may be omitted for Static mode.
  • variable: Required. The name of the variable script to evaluate.
  • range: Optional. When present, the Rotation operates in Threshold Mode. When absent, it operates in Boolean Mode.
  • blend: Optional. Default false. Ignored if 'range' is not present. When true, the transform is spherically interpolated between startRotation and endRotation based on where in the range the variable falls.
  • longPath: Optional. Default false. Ignored if 'blend' is not true. When true, the rotation will take the longer route to cycle from the start to the end position, instead of the shortest possible route.
  • modulo: Optional. Default 0.0. Ignored if 'blend' is not true. When set to a positive value, modulo allows for a variable to cycle a rotation repeatedly around a circle without requiring it to animate the entire transition (such as looping repeatedly).
  • speed: Optional. Default 0.0. Ignored if 'blend' is not true, or if speed is not positive. The speed parameter describes how quickly the animation can go from 'startRotation' to 'endRotation', in seconds. Thus, numbers larger than one are faster, while smaller numbers are slower. If 'modulo' is also valid, 'speed' represents how quickly the Rotation can complete a single circuit.

TEXT_LABEL

The Text Label action is used to display text. The text can be static (text that is generated once, and then never altered), or it can be dynamic. In addition, the text can be configured several different ways to switch between emissive and non-emissive modes. There are many configuration options available for a Text Label.

The 'emissive' field controls when or if the text is emissive. When set to 'always', the text will glow at all times. When set to 'active', the text glows when the variable is greater than zero. The 'passive' setting causes the text to glow only when the variable is zero (the opposite of 'active'). Use 'never' is the text should never glow, and use 'flash' to make the text glow when the when the text is in the "flash on" state. If the Text Label is configured in Static Mode, the default for 'emissive' is 'always'. For all other modes, the default is 'active'.

If the first character of text is a quotation mark ("), then the TEXT_LABEL will preserve any whitespace it encounters. This capability is primarily intended for use with ASET RPM to MAS upgrades.

The Text Label supports Boolean Mode, Threshold Mode, Blend Mode, and Static Mode.

TEXT_LABEL
{
	name = Name Plate
	transform = IndicatorNameObj
	fontSize = 2.3
	//oneshot = true
	font = InconsolataGo
	style = Bold
	alignment = Center
	anchor = MiddleCenter
	transformOffset = 0.0087,-0.0015
	emissive = active
	//emissive = always
	variable = fc.GetPersistent("MOARdV_Backlight")
	//blend = true
	//lineSpacing = 1.0
	flashRate = 1.0
	activeColor = COLOR_MOARdV_BacklightColor
	passiveColor = COLOR_MOARdV_UnlitText
	text = RCS
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The transform in the prop where you want to apply the text.
  • fontSize: Required. How large the text should be in arbitrary units.
  • oneshot: Optional. Default false. If true, 'text' is considered immutable, meaning that is will never be updated after its initial value is determined. If no variables are included in 'text', it automatically is treated as immutable, so this parameter is only needed for text that consumes variables that you know won't need updates after initialization.
  • font: Required. The name of the Fonts to use. Supported fonts include system fonts (which may not be on every computer) and the fonts included in MAS.
  • style: Optional. Default 'Normal'. The style of the font. May be 'Normal', 'Bold', 'Italic', or 'BoldAndItalic'.
  • alignment: Optional. Default 'Left'. Controls horizontal justification of the text. Valid options are 'Left', 'Right', and 'Center'.
  • anchor: Optional. Default 'UpperLeft'. Controls vertical justification of the text. Valid options are combinations of the prefixes 'Upper', 'Middle', or 'Lower' and the suffixes 'Left', 'Center', or 'Right'.
  • transformOffset: Optional. Default (0, 0). Allows the text to be displaced from the specified transform.
  • emissive: Optional. Default 'active' or 'always'. Valid options are 'active', 'always', 'never', 'flash', or 'passive'.
  • variable: Optional. Required if activeColor is defined. The variable that controls text color and emissive properties.
  • blend: Optional. Default false. Allows the text to blend smoothly between 'activeColor' and 'passiveColor'. 'lineSpacing**: Optional. Default 1.0. Scaled line-to-line spacing on multi-line text.
  • flashRate: Optional. Default 0.0. Ignored if 'blend' is true. Sets the flash rate of the text when the controlling variable is in range. Provides 1/2 of the duty cycle of the flash (so a flashRate of 0.5 means "on for 0.5 seconds, off for 0.5 seconds").
  • activeColor: Optional. Required is 'variable' is defined. Defines the color of the text when the variable is in range.
  • passiveColor: Required. Defines the default color of the text if 'variable' is not defined, and the color of the text when 'variable' is defined and it is out of range.
  • text: Formatted rich text (see Formatted Rich Text).

If 'variable' and 'activeColor' are omitted, the Text Label operates in Static Mode.

TEXTURE_REPLACEMENT

This action is used to replace the texture on a given transform with a different texture. Its primary use is to add flag decals to specific parts, although it could be used for other purposes as well.

TEXTURE_REPLACEMENT
{
  name = Flag
  transform = MissionLabelObj
  texture = %FLAG%
  //layers = _MainTex _Emissive
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The transform in the prop where you want to replace the texture.
  • texture: Required. The path to the texture that should be used. May use %FLAG% to select the current mission flag.
  • layers: Optional. Default '_MainTex'. A space-delimited list of which layers the texture should be replace. Known valid options are '_MainTex' and '_Emissive'.

TEXTURE_SCALE

This action is used to change the texture scale values attached to a specified Transform in the prop object.

The texture scale may be controlled in several ways. When only startUV is specified, the texture scale may be a constant scaling. It may also be a variable-controlled shift, since startUV may contain variables. In addition, texture scale supports Boolean mode, Threshold mode, and Blend mode.

Both startUV and endUV support variables for their values, so it is possible to create very complex scaling involving variable startUV and endUV values blended with variable.

TEXTURE_SCALE
{
  name = Arrow
  transform = LabelObj
  startUV = 0.5, 0.6
  //endUV = 1.0, 0.6
  layers = _MainTex _Emissive
  //variable = fc.GetPersistent("Interior Lights")
  //blend = true
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The transform in the prop where you want to scaling the texture UVs.
  • startUV: Required. The initial (u,v) scale for the texture.
  • endUV: Optional, required if variable is present. The (u,v) scale for the texture when the variable is in range.
  • layers: Optional. Default '_MainTex'. A space-delimited list of layers where the texture scale should be applied. Known valid options are '_MainTex' and '_Emissive'.
  • variable: Optional. The name of the variable script to evaluate.
  • blend: Optional. Default false. When true, the texture scale is linearly interpolated between startUV and endUV based on where in the range the variable falls.

The example above shows a static texture scale.

TEXTURE_SHIFT

This action is used to shift the texture coordinates attached to a specified Transform in the prop object.

The texture shift may be controlled in several ways. When only startUV is specified, the texture shift may be a static shift, such as for a texture atlas. It may also be a variable-controlled shift, since startUV may contain variables. In addition, texture shift supports Boolean mode, Threshold mode, and Blend mode.

Both startUV and endUV support variables for their values, so it is possible to create very complex shifts involving variable startUV and endUV values blended with variable.

TEXTURE_SHIFT
{
  name = Arrow
  transform = LabelObj
  startUV = 0.5, 0.6
  //endUV = 1.0, 0.6
  layers = _MainTex _Emissive
  //variable = fc.GetPersistent("Interior Lights")
  //blend = true
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The transform in the prop where you want to shift the texture.
  • startUV: Required. The initial (u,v) displacement for the texture.
  • endUV: Optional, required if variable is present. The (u,v) displacement for the texture when the variable is in range.
  • layers: Optional. Default '_MainTex'. A space-delimited list of layers where the texture shift should be applied. Known valid options are '_MainTex' and '_Emissive'.
  • variable: Optional. The name of the variable script to evaluate.
  • blend: Optional. Default false. When true, the texture is linearly interpolated between startUV and endUV based on where in the range the variable falls.

The example above shows a static texture shift.

TRANSLATION

A translation may be used to displace a portion of a prop, such as moving the needle of an indicator or shifting a joystick or throttle position.

TRANSLATION
{
	name = Right Arrow
	transform = ArrowRightLoc
	startTranslation = 0,0,0
	endTranslation = 0,0,0.005
	variable = fc.GetThrottle()
	blend = true
	//speed = 1.0
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • transform: Required. The name of the transforms that contain lights.
  • startTranslation: Required. The displacement for the initial position. This value is used for Static mode, as well as the other modes for values out of range.
  • endTranslation: Required. The displacement for the final position. This value may be omitted for Static mode.
  • variable: Required. The name of the variable script to evaluate.
  • blend: Optional. Default false. When true, the translation is interpolated between startTranslation and endTranslation based on where in the range the variable falls.
  • speed: Optional. Default 0.0. Ignored if 'blend' is not true, or if speed is not positive. The speed parameter describes how quickly the animation can go from 'startTranslation' to 'endTranslation', in seconds. Thus, numbers larger than one are faster, while smaller numbers are slower.

TRIGGER_EVENT

This action is used to activate an event when a specified variable is true. The event may be configured as a repeated event by setting 'autoRepeat' to true, which will fire the event every FixedUpdate until the variable is no longer in range.

Use caution with a Trigger Event: if there are multiple occurrences in a single craft, every single trigger event will fire, unless the script it runs was designed to "know" if it's being called multiple times per update.

TRIGGER_EVENT
{
	name = My Cool Action
	event = MyCoolAction()
	//exitEvent = MyCoolExitAction()
	variable = fc.GetPersistent("Interior Lights")
	//autoRepeat = true
}
  • name: Optional. Default '(anonymous)'. A name for the action.
  • event: Required. The event that is triggered when the trigger event is active.
  • exitEvent: Optional. An event that is triggered when the trigger event is no longer active. This event will only be triggered after event has fired.
  • variable: Required. The name of the variable script to evaluate.
  • autoRepeat: Optional. Default 'false'. When set to true, the event triggers every FixedUpdate until the variable is no longer true.
⚠️ **GitHub.com Fallback** ⚠️