-
Notifications
You must be signed in to change notification settings - Fork 27
MASMonitor
The MASMonitor prop module powers monitor displays ranging from simple single-line digital readouts to full-featured MFDs. MASMonitor is more complex to set up than a MASComponent, since it entails a render texture and multiple pages. The MASMonitor is comparable to the RasterPropMonitor class, but it is substantially more flexible in its design.
Each monitor 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.
When placing components in a monitor, the upper left corner is treated as the origin (0, 0), and positive Y is "down" on the display. For graphical components, displacement is by pixel, while text displacement is by character (based on the fontSize).
MODULE
{
name = MASMonitor
screenTransform = FlatMon40x10Screen
//layer = _Emissive
screenSize = 512, 512
font = InconsolataGo
style = Bold
fontSize = 16, 32
textColor = 255, 255, 255, 255
backgroundColor = 0, 0, 32, 255
monitorID = %AUTOID%
//startupScript = MAS_InitializeMe()
//++ TODO
//variable = blah
//disabledColor = blah ?
//-- TODO
page = Standby_Page
page = Orbit_Page
...
}
The configuration parameters are
- screenTransform: Required. The name of the transform in the prop that contains a screen display.
- layer: Optional. Defaults to '_Emissive'. A space-separated list of the layers in 'screenTransform' that will be rendered to.
- screenSize: Required. The width and height of the render texture that the monitor will use.
- font: Required. The name of the Fonts (bundled, system, or user) that is used for rendering text.
- style: Optional. Defaults to 'Normal'. The font style to use rendering the default font. May be one of 'Normal', 'Bold', 'Italic', or 'BoldAndItalic'.
- fontSize: Required. The width and height of the text that is rendered on the monitor, in screen pixel size. All texts will be fixed-width, even if the referenced font is not.
- textColor: Required. The default color of text rendered on the screen. Colors may be overridden with tags (see Formatted Rich Text).
- backgroundColor: Required. The color the monitor will be cleared to before rendering.
- page: Required. One or more entries referring to named pages that are displayed on the monitor. Pages may be omitted, in which case the monitor won't do anything. The first listed page is the default page that is visible when first entering IVA.
- monitorID: Optional. Defaults to '%AUTOID%'. Specifies the name of the persistent variable used to contain the current page selection. Defaulting to %AUTOID% allows on-prop buttons to likewise use %AUTOID%, but a unique name might be better for a monitor controlled by props located elsewhere.
- startupScript: Optional. Allows the prop designer to specify a script that is executed while MAS configures the prop.
CAUTION: Only use one MASMonitor per prop. Multiple MASMonitor modules will lead to incorrect behavior.
Many MFDs contain softkeys that have different effects depending on the active page. To support this capability in MAS, there is an action fc.SendSoftkey(monitorName, softkeyNumber)
(see). This action sends a number to the monitor whose monitorID
is set to monitorName
.
If the currently-active page on the given monitor includes a softkey
field corresponding to the softkeyNumber
(see below), then the page will trigger the listed action. If there is no softkey
field for the given number, then the key event is passed to each of the components of that page. At present, only RPM_MODULE
components will consume a softkey event, although future modules may do so, as well.
Some MFDs have a collider situated over the screen. This collider, when configured using COLLIDER_ADVANCED, will send X and Y coordinates for where in the collider the player clicked. These click events are processed by the page using information in hitbox
nodes, allowing for the emulation of a touch screen display. For more information on using hitboxes, see Touch Screens.
Note that hitbox sizes must be positive values.
The hitboxes for a page are processed in the order that they are listed in the MAS_PAGE node. The first hitbox that contains the coordinates of the click will consume the click, meaning that no hitboxes listed later in the page's config node will process the event. This allows for a default hitbox to be placed last in the config that is activated if no other hitbox covers the click coordinates.
Each hitbox may have one or more event handlers. The onClick
event is generated when the player taps the page within the bounds of the hitbox. The onDrag
event is generated each time the mouse is moved after clicking within the hitbox, and the onRelease
event is generated when the mouse is released. Note that onDrag
and onRelease
events will be generated even if the mouse leaves the bounds of the hitbox as long as the mouse is held down. One of onClick
, onDrag
, or onRelease
must be defined for each hitbox. Any combination of the three functions can be used.
The behaviors defined for onClick
, onDrag
, and onRelease
may use the special keywords %X%
and/or %Y%
. These keywords will report the X and Y coordinate of the event, as adjusted to the hitbox position. For example, if a hitbox uses position = 32, 32
and size = 64, 64
, then a mouse click that hits at 43, 38 will set %X%
to 11 and %Y%
to 6.
Be aware that it is possible for the mouse to be dragged outside the bounds of the hitbox while it is pressed. If the mouse moves out of bounds, %X%
and %Y%
are both set to -1. If you plan on using these keywords in an onDrag
or onRelease
event, make sure the script handles these cases.
Each hitbox node is configured as follows:
hitbox
{
position = x, y
size = width, height
onClick = myClickHandler()
onDrag = myDragHandler()
onRelease = myReleaseHandler()
variable = myEnableVariable()
}
- position: Required. Contains the X and Y corner of the rectangle that the hitbox covers. Note that corner values must be numbers - variables and mathematical expressions are not supported.
- size: Required. Contains the width and height of the rectangle that the hitbox covers. Note that size values must be positive numbers - variables and mathematical expressions are not supported, and sizes equal to or smaller than 0 are not supported.
- onClick: See notes above. The event that is triggered when a click takes place within the bounds of the hit box.
- onDrag: See notes above. The event that is triggered when the mouse moves after being clickede within the bounds of the hit box.
- onRelease: See notes above. The event that is triggered when the mouse is released after being clicked within the bounds of the hit box.
- variable: Optional. When present, the variable will control whether this hitbox processes taps or not.
MAS_PAGE
{
name = Standby_Page
//softkey = 0, fc.SetPersistent("%AUTOID%", "MAS_ALCOR_MFD_A_Land")
//softkey = 1, fc.SetPersistent("%AUTOID%", "MAS_ALCOR_MFD_A_Launch")
...
//hitbox
//{
// corner = 904, 0
// size = 112, 40
// onClick = fc.SetPersistent("%AUTOID%", "MAS_KFS_TS_Standby")
//}
...
//onEntry = CustomPageEntry("%AUTOID%")
//onExit = CustomPageExit("%AUTOID%")
}
Monitor pages are defined in config files using the MAS_PAGE node type. Each page must have a name. A page may have one or more nodes inside it describing the page layout (text, graphical objects, etc). These nodes are layered during rendering, with the first node listed being the farthest from the camera (and thus appearing below other components that are superimposed over them). If a page has no nodes, it will result in a completely blank page.
Individual nodes may be optionally disabled and enabled by querying a variable, in much the way that MASComponent actions use variables. Page nodes only support the Boolean and Threshold Modes.
In addition to the component nodes, a page may have a number of softkey =
entries. Each of these entries map a softkey number to an action, allowing each page on the MFD to have customizable behavior attached to soft keys. Additionally, a page may have hitbox
nodes to define locations within an Advanced Collider boundary that will respond to taps. These hitboxes are used to emulate touch screen MFDs. For more information on using hitboxes, see Touch Screens. Note that both softkeys and touch screen functionality may be used on the same display.
Each page may include one or both of the optional onEntry
and onExit
entries. Each of these entries references an action (either a MAS function or a custom script) that is executed when the page becomes active (for onEntry
) or becomes no longer active (onExit
). The onEntry
action is called for the default page when the craft is first loaded, and for every active page when the craft is reloaded. The onExit
action is called when switching to a new page, prior to the new page's onEntry
call. This feature could be used, for instance, to allow the new page to know which page was previously active, allowing a "back" feature.
Because fonts are treated as fixed-width, there is the possibility that scaling problems will cause unusually-wide characters to be compressed horizontally, which may hinder readability. This problem may be worse if the [hw] tag is used with those fonts.
Pages are selected by setting the persistent identified by monitorID
to the name (string) of the desired page. In the example config above, for instance, a button on the same prop could use fc.SetPersistent("%AUTOID%", "Orbit_Page")
to select the second page in the list.
Note that all nodes in a page support the variable
parameter to control whether the node is visible. This variable only operates in Boolean Mode - that is, if the variable is greater than zero, the node is visible. If it is less than or equal to zero, the node is not rendered. To only make the node visible within a specific range of values, use fc.Between(variable, range1, range2)
.
The following nodes may be placed within a MASMonitor.
- CAMERA - Displays the contents of a MASCamera
- COMPOUND_TEXT - Displays multiple rows of text, each of which are shown or hidden by separate variables.
- ELLIPSE - Draws an ellipse, circle, or arc of specified width and color.
- GROUND_TRACK - Renders ground track lines suitable for placing over a map.
- HORIZON - Renders the "ladder" component of an artificial horizon (note that the IMAGE node, below, can do very nearly the same thing).
- HORIZONTAL_BAR - Draws a filled configurable horizontal bar graph.
- HORIZONTAL_STRIP - Draw a horizontally-scrolling texture, such as for a heading strip on a HUD.
- IMAGE - A highly-configurable image renderer. Color, size, rotation, and position can all be specified using variables in addition to hard-coded numbers.
- LINE_GRAPH - Draws a line graph displaying the value of a variable over a period of time.
- LINE_STRING - Draws a sequence of connected line segments.
- MENU - Provides a menu drawing and processing system.
- NAVBALL - Draws a navball.
- ORBIT_DISPLAY - Draws a line art schematic of the current body, its atmosphere, and the vessel's orbit.
- POLYGON - Draws an arbitrary two-dimensions closed simple polygon.
- ROLLING_DIGIT - Simulates a mechanical odometer or other numeric display.
- RPM_MODULE - Provides an interface to existing RasterPropMonitor modules included in other mods (such as SCANsat or DPAI).
- SUB_PAGE - Inserts a MAS_SUB_PAGE node into the page, simplifying reuse of common design patterns.
- TEXT - Renders text. Note that monitor text is always fixed-width.
- VERTICAL_BAR - Renders a vertically-oriented bar graph.
- VERTICAL_STRIP - Renders a portion of a texture that scrolls vertically, such as the altitude or speed strips on a HUD.
- VIEWPORT - Used to mask sections of a display.
The Camera node renders the view from cameras on board the vessel. Such cameras can be used for docking, or inspecting the exterior of the craft, or surveying things from a distance. The camera objects are created by adding a MASCamera module to a part and correctly configuring it.
Cameras are accessed by name, and each camera should have a unique name. To allow some generalization in monitor configuration, the MASFlightComputer has methods that allow cameras to be addressed by number, but MAS makes no guarantees on the ordering of those cameras.
For the most efficient use of memory, the size of the camera should be a power-of-2 (64, 128, 256, 512). It does not have to be square. For instance, a 512 x 256 size is okay.
The CAMERA node may use post-processing shaders. These shaders are applied after any shaders used by the active camera's current mode. This feature is intended to allow non-color monitors (black-and-white, green-screen, or amber-screen) to process the image from a MASCamera before it is displayed.
CAMERA
{
name = ActionCam
position = 0,0
size = 256, 256
camera = "MyActionCam"
//camera = fc.GetCameraName(0)
//camera = fc.GetPersistent("My-Active-Camera-Variable")
//variable = fc.GetPersistentAsNumber("ShowCamera")
//missingTexture = ""
//shader = MOARdV/MonochromeNoise
//properties = _ChannelG:1;_ChannelR:0.118;_ChannelB:0.118
//texture = ASET/ASET_Props/MFDs/ScreenPlates/noise
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The location on the monitor where the upper-left corner of the camera view will be placed.
- size: Required. The size of the camera view.
- camera: Required. Identifies which camera should be rendered. If an invalid name is provided, nothing is rendered.
- variable: Optional. When present, the variable will control whether the camera view is rendered or not.
- missingTexture: Optional. The 'missingTexture' provides the URI to a texture that should be displayed if MAS is unable to find the selected camera. This "missing camera" texture is also displayed when the active camera is no longer available (for instance, if it is lost due to staging or undocking).
- shader: Optional. If present, and set to one of the included Shaders, this Camera node will apply a post-processing shader effect to the image MASCamera provides before showing it. If the 'shader' is not included, the camera mode will display the MASCamera image with no additional effects applied.
- properties: Optional. Ignored if 'shader' is absent. The 'properties' field is a semi-colon (;) separated list of name:value pairs that controls various tunable parameters in the shader. Refer to the Shaders page for more information.
- texture: Optional. Ignored if 'shader' is absent. The texture field provides the name of a texture that is used in the shader (where applicable, such as the noise shaders).
A Compound Text node allows multiple lines of text to be displayed, with a separate variable controlling whether each line is visible. This feature could be used to provide a checklist, with text disappearing when a given task is completed. It could also be used for a prioritized alert system, with higher-priority warnings displayed above lower-priority warnings.
While such a capability can be accomplished using a TEXT node, the results would have blank lines scattered about. COMPOUND_TEXT will move text lines together to prevent blank lines in the middle of the text region. It can also be configured to show a maximum number of lines of text, so the display can be used in a limited space with only high-priority information visible.
As an attempt to illustrate this, say there vessel has several different alarms. There are URGENT alarms, IMPORTANT alarms, WARNING alarms, and NOTIFICATION alarms. Using a TEXT node for each category, the MFD would have four rows of text:
URGENT
IMPORTANT
WARNING
NOTIFICATION
If only the URGENT and NOTIFICATION alerts were active, the display would look like
URGENT
NOTIFICATION
If you later want to add a VERY IMPORTANT alert, you would need to resize the space you're setting aside on-screen for these notices to have five rows of text, potentially wasting valuable screen space when most of them aren't visible.
With Compound Text, the URGENT and NOTIFICATION alerts would be displayed as
URGENT
NOTIFICATION
instead.
In this example, it's not that big of an improvement. But, the COMPOUND_TEXT can be told to limit the number of items it will display. Instead of using four lines to display the four alert categories, COMPOUND_TEXT could be told to display only two lines, so the alerts would appear as
URGENT
NOTIFICATION
If an IMPORTANT alert triggered, the display would contain
URGENT
IMPORTANT
because the NOTIFICATION is a lower-priority message, and the Compound Text was configured to display only the top two texts.
A Compound Text node should contain at least one TEXT child node, but it's intended to contain many (MAS does not impose a limit).
COMPOUND_TEXT
{
name = testCT
position = 0, 3
maxLines = 4
//font =
//style =
//fontSize =
//textColor =
//variable = fc.GetPersistentAsNumber("ShowCompoundText")
TEXT
{
name = node1
text = Rcs ON: <=0:0=> $&$ fc.AltitudeTerrain(false)
variable = fc.GetRCS()
//range =
}
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Optional. Default (0, 0). An offset from the upper-left corner for the text being rendered. The offset is in units of character columns and rows, not pixels. The row and column size is based on the 'fontSize' of the MASMonitor, not the optional 'fontSize' specified in the COMPOUND_TEXT node.
- maxLines: Required. Tells MAS the maximum number of lines to display.
- font: Optional. The name of the font to use for rendering this text. If this parameter is omitted, the font listed in the MASMonitor config section is used.
-
style: Optional. Default 'Normal'. The style of font to use, if available. Valid options are
Normal
(the default),Bold
,Italic
, andBoldAndItalic
. Note that the use of Formatted Rich Text tags that change the style will override thestyle
field. - fontSize: Optional. The width and height of this text as rendered on the screen, in pixels. If it is omitted, the default from MASMonitor is used.
- textColor: Optional. The default text color for this text. If the entry is omitted, the default found in MASMonitor is used.
- variable: Optional. When present, the variable will control whether any of the compound text is rendered or not.
In addition, each Compound Text node contains child TEXT nodes (possibly many). These describe the text that is displayed, the conditions to display that text, and the priority of the text (TEXT nodes listed earlier take priority over TEXT nodes listed later). The 'text' entry for each TEXT node should be a single line of text (no '$$$' line breaks), since MAS can not track line breaks embedded in the 'text' field. If multiple lines of text are needed, list each one as a separate TEXT node using the same 'variable' and 'range' settings.
- name: Optional. Default '(anonymous)'. A name for the TEXT child node.
- text: Optional. If not present, will insert a blank line, allowing space between different categories of notices. When present, this is the text that is displayed when this TEXT child node is visible.
- variable: Optional. When present, the variable will control whether this text is rendered or not. When missing, this text is always visible.
- range: Optional. Ignored if 'variable' is not present. When present, the 'variable' operates in Threshold Mode; when absent, the 'variable' operates in Boolean Mode.
An Ellipse node draws a closed line string around a center location, appearing as a circle (when both the X and Y radius are the same) or an ellipse (when the radii differ). The ellipse is extremely configurable, allowing variables to alter the start color and line width, as well as end color and line width.
Ellipses may also use a texture to apply effects, such as a dotted line. The texture is applied with the U coordinate increasing between vertices, while the V coordinate increases across the width of the line. MAS adjusts the texture scale to attempt to keep the displayed texture at a 1:1 scale along the U direction (that is, if the texture is 32 pixels long, MAS will try to adjust the texture's scaling so it repeats every 32 pixels of line length).
A start angle and end angle may be optionally supplied. Either or both may be variables. These values describe the portion of the ellipse that should be rendered, allowing for circular gauges to be simulated, for instance. An angle of 0 points directly at the right side of the screen (+X), and an angle of 90 points at the top of the screen (-Y). Yes, this is a right-handed coordinate system being used on the screen's left-handed coordinate system.
In the example below, if startAngle
and endAngle
were uncommented, the ellipse would grow clockwise in response to increasing throttle, until it covered a 270 degree angle. Note that angle increases anti-clockwise.
There is no arbitrary limit to the number of vertices that can be used in an ellipse.
ELLIPSE
{
name = Some round lines
position = 256, 256
//texture = path/to/texture
startColor = 155, 255, 155, 255
endColor = fc.GetThrottle() * 155, 255, 0, 255
startWidth = 3.5
//endWidth = 4.5
vertexCount = 32
radiusX = 5.0
//radiusY = 5.0
//startAngle = 180
//endAngle = 180 - 270*fc.GetThrottle()
//variable = 1
//rotation = fc.GetRoll()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The pixel offset from the upper-left corner of the page for the origin of the ellipse.
- texture: Optional. A URI to a texture that will be applied to the lines of the ellipse.
- startColor: Required. The color of the ellipse at the first vertex (directly to the right when not rotated). The line will smoothly blend from this color to 'endColor'.
- endColor: Optional. Defaults to 'startColor'. The color of the ellipse at the last vertex, once it has wrapped around the origin.
- startWidth: Required. The width of the line string (in pixels) at the first vertex. The line will smoothly blend from this width to 'endWidth'.
- endWidth: Optional. Defaults to 'startWidth'. The width of the line string (in pixels) at the last vertex.
- vertexCount: Required. Must be at least 3. Determines the number of vertices used to create the ellipse (more vertices results in a higher quality curve, but it also increases the overhead of creating the ellipse).
- radiusX: Required. Describes the radius of the ellipse along the horizontal (X) axis.
- radiusY: Optional. Describes the radius of the ellipse along the vertical (Y) axis. When omitted, radiusY = radiusX, creating a circle.
-
startAngle: Optional. Required if
endAngle
is included. Defaults to 0. The starting angle, in degrees, of the arc to draw, assumingrotation
is 0. An angle of 0 points directly at +X (the right side of the screen), and an angle of +90 points towards the top of the screen (-Y). -
endAngle: Optional. Required if
startAngle
is included. Defaults to 360. The ending angle, in degrees, of the arc to draw, assumingrotation
is 0. An angle of 0 points directly at +X (the right side of the screen). - variable: Optional. When present, the variable will control whether this line string is rendered or not.
- rotation: Optional. When present, the 'rotation' variable will rotate all of the line strings around 'position'.
The Ground Track node provides orbital ground tracks suitable for display over a map. The Ground Track will render up to three different orbital tracks: the active vessel's current track, a target's track, and a post-maneuver node orbital track.
GROUND_TRACK
{
name = Ground track
position = 0, 432
size = 1024
lineWidth = 5
vertexCount = 32
vesselColor = 71, 154, 151, 255
targetColor = 192, 0, 192, 255
maneuverColor = COLOR_XKCD_KSPNOTSOGOODORANGE
startLongitude = fc.Longitude() - 180
//variable = ShowGroundTrack()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The pixel offset from the upper-left corner of the page for the origin of the ellipse.
- size: Required. The width in pixels of the ground track's drawing area. The height of the ground track is always 1/2 of the width (2:1 aspect ratio).
- lineWidth: Required. The width in pixels of the ground track's line.
- vertexCount: Required. The number of vertices in the line. More vertices will result in smoother lines, but more processing work. For orbits with lower inclinations, 32 vertices is usually plenty.
- vesselColor: Optional. The color to use to draw the current vessel's ground track. If this field is not present, the current vessel's ground track is not rendered.
- targetColor: Optional. The color to use to draw the current target's ground track. If this field is not present, or there is no current target, or the current target is in a different sphere of influence, the target orbit is not drawn.
- maneuverColor: Optional. The color to use to draw the resulting ground track after a scheduled maneuver. If this field is not present or there is no maneuver, the target orbit is not drawn.
-
startLongitude: Optional. Defaults to -180. The longitude that represents the left-most edge of the ground track. Using a variable (such as
fc.Longitude() - 180
for this number allows for scrolling maps. - variable: Optional. When present, the variable will control whether the ground track is rendered.
The Horizon node renders an artificial horizon, such as would be found on aircraft. It is not intended to replace a navball for full 3D positional data, since it only provides visual roll and pitch cues. Note that both the pitch and roll variables are user configurable, so there is no requirement to use this feature strictly for those flight parameters.
The texture is treated like a Vertical Strip with the additional feature of being able to rotate the texture around the center of its displayed area. Texture coordinates are clamped, so for best results, the texture should have a one pixel wide border of whatever the background color should be.
HORIZON
{
name = horizon
texture = JSI/RasterPropMonitor/Library/Components/HUD/ladder
position = 0,0
size = 256, 256
pitch = fc.Pitch()
pitchRange = -90, 90
displayPitchRange = 1536,512
roll = fc.Roll()
rollRange = -180,180
displayRollRange = -180,180
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- texture: Required. The texture that will be used for the horizon.
- position: Required. The location on the monitor where the center of the horizon will be placed.
- size: Required. The size of displayed portion of the horizon.
- pitch: Required. The variable that controls vertical texture movement.
- pitchRange: Required. The range of values that will affect the horizon pitch. Values outside this range are clamped to this range.
- displayPitchRange: Required. The pixel offsets from the top of the texture that correspond to the first and second 'pitchRange' values.
- roll: Required. The variable that controls texture roll.
- rollRange: Required. The range of valid roll values. Values outside this range are clamped to this range.
- displayRollRange: Required. The range that the texture will be rotated. Maximum values should stay between [-180, +180] for a normal horizon.
- variable: Optional. When present, the variable will control whether the horizon is rendered or not.
A Horizontal Bar node renders a bar graph that grows or shrinks horizontally in response to the source variable. The bar graph may be a solid color, or it may use a texture. If a texture is used, the UV values are scaled in proportion to how full the bar is (in other words, the texture is not squished as the bar goes from full to empty), which allows a texture with a gradient or other pattern to be used.
HORIZONTAL_BAR
{
name = G-Forces
position = 16, 272
size = 128, 32
source = fc.GForce()
sourceRange = 0, 5
sourceColor = 192,192,128,255 // Optional, may be white for texture application. Or not.
//texture = AvionicsSystems/Textures/horiz_bargraph
anchor = Left
borderWidth = 2
borderColor = 128, 64, 64,255
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The location on the monitor where the upper-left corner of the bar graph will be placed.
- size: Required. The size of the graph.
- source: Required. The variable that will be graphed.
- sourceRange: Required. The values for the left and right ends of the bar.
- sourceColor: Optional. Defaults to white. The color of the bar graph.
- texture: Optional. When present, the named texture is drawn so it will fill the graphs area. Color textures may be used - the sourceColor is multiplied by the texture color in that case. If no texture is provided, the graph is treated as a solid color.
- anchor: Optional. Defaults to 'Left'. Defines the anchor of the bar graph. 'Left' means the left side of the region, in which case the graph grows towards the right. 'Right' means the opposite: the graph starts on the right and it grows to the left. 'Middle' mwans the graph starts in the center, and it grows to the left if the source value is below 1/2 of the range, or it grows to the right if the source value is above 1/2 of the range.
- borderWidth: Optional. Required if 'borderColor' is present. The width in pixels for a border surrounding the graph area. This border is placed outside the region specified by 'position' and 'size'. In the above example, the border is 2 pixels wide, which means it is in x-position 14-16 and 496-498.
- borderColor: Optional. Required if 'borderWidth' is present. The color of the graph's border.
- variable: Optional. When present, the variable will control whether this strip is rendered or not.
A Horizontal Strip node renders part of a texture in response to a variable input. It can be used for a virtual compass instrument or other applications. The full height of the source texture is always displayed in a horizontal strip, but only a portion of the width is visible at any given time.
HORIZONTAL_STRIP
{
name = Heading
texture = JSI/RasterPropMonitor/Library/Components/NavBall/hdg2
position = 448,20
size = 128,24
input = fc.Heading()
inputRange = 0, 360
displayRange = 0,1024
displayWidth = 128
//wrap = false
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- texture: Required. The texture that will be used for the horizontal strip.
- position: Required. The location on the monitor where the upper-left corner of the strip will be placed.
- size: Required. The size of displayed portion of the strip.
- input: Required. The variable that will be used to control the strip.
- inputRange: Required. The range of values that will affect the position of the displayed strip. The result of 'input' is clamped to this range.
- displayRange: Required. Controls how the 'inputRange' is mapped to texture locations. Lists the position in pixels for the lower and upper bound of the displayed image. For instance, in the above example, when heading is 0, the 0 pixel location is in the center of the strip. When the heading is 180, the 512 pixel is visible.
- displayWidth: Required. The width of the visible portion of 'texture', in pixels as measured on the texture. Eg, if the texture is 512 pixels wide, and you want the 25% of it visible, you would use 'displayWidth = 128'.
- wrap: Optional. Default false. When true, indicates that the texture is expected to wrap around (like a continuous ribbon). When false, the texture coordinates are clamped to the ends of the texture.
- variable: Optional. When present, the variable will control whether this strip is rendered or not.
An Image node renders an image. The image's position and size may be specified, including resizing the image from its original.
The color options perform a component-by-component multiplication of the color in the texture with the color specified in the config. Using a white texture (RGB = 255, A varies for transparency) allows the reuse of a single texture for many different applications by applying color shifts. There are multiple ways of using the color shift options:
- Use only
passiveColor
: Using a non-variable value forpassiveColor
allows tinting the texture. Each channel ofpassiveColor
may also be a variable, allowing blended color shifts. - Use
colorVariable
: Allows many different ways to change colors.activeColor
andpassiveColor
both may use variables for each channel, andcolorVariable
may be used in Boolean Mode, Threshold Mode, or Blend Mode.
When selecting the %MAP_ICON%
special texture name to display stock map view icons, there are a few things to know:
-
tiling
must be set to0.2, 0.2
to display a single icon. - Icons may be selected using the
fc.MapIconU(iconId)
andfc.MapIconV(iconId)
(see) fields for theuvShift
setting. TheiconId
parameter of both of those functions can be automatically set by usingfc.TargetTypeId()
(see) for targets, orfc.VesselTypeId()
(see) for the current vessel. - With the exception of the "EVA Kerbal" icon, all icons are uncolored, so
passiveColor
will need to be used to re-tint the icons. - The "Plane" icon and "Relay" icon are not part of the %MAP_ICON% atlas, so the "Ship" icon and "Probe" icon are used, instead.
When selecting the %NAVBALL_ICON%
special texture name to display stock navball icons, there are a few things to know:
-
tiling
must be set to0.3333, 0.3333
to display a single icon. - Icons may be selected using the
fc.NavballU(iconId)
andfc.NavballV(iconId)
(see) fields for theuvShift
setting. - All icons are uncolored (white), so
passiveColor
and/oractiveColor
will need to be used to re-tint the icons. To assist in this,fc.NavballR(iconId)
,fc.NavballG(iconId)
, andfc.NavballB(iconId)
(see) will provide the R, G, and B values for coloring these icons to match stock colors.
IMAGE
{
name = PFD overlay
texture = JSI/RasterPropMonitor/Library/Components/NavBall/StaticMask
//position = 128,256
//size = 256,256
//variable = fc.GetPersistentAsNumber("ShowImage")
//rotation = fc.Roll()
//rotationOffset = 64, 0
//passiveColor = 255, 255, 255, 255
//activeColor = COLOR_ASET_ACTIVE_COLOR
//colorVariable = fc.GetThrottle()
//colorRange = 0, 1
//colorBlend = true
//tiling = 1, 1
//uvShift = 0, 0
//wrap = false
}
- name: Optional. Default '(anonymous)'. A name for the node.
-
texture: Required. A URI to the texture that will be displayed. May also be the
%FLAG%
or%MAP_ICON%
Keyword. - position: Optional. Default (0,0). The pixel offset from the upper-left corner of the page.
- size: Optional. Defaults to the native size of the texture. Specifies the desired pixel width and height of the image.
- variable: Optional. When present, the variable will control whether this image is rendered or not.
- rotation: Optional. Applies a rotation to the image in degrees as provided by the variable. Rotation is anchored around the center of the image (unless moved with 'rotationOffset'), with a clockwise winding.
- rotationOffset: Optional. Default (0, 0). Ignored when 'rotation' is not present. Moves the center of rotation from the middle of the image by the specified distance in pixels (+X is to the right, +Y is down, like other monitor coordinates).
- passiveColor: Optional. Required if 'colorVariable' is present. Applies tinting to the image. Can be used without 'colorVariable' either to apply a constant color, or a variable color, as described above. May be a named color, constant values, or per-channel variables.
- activeColor: Required if 'colorVariable' is present, ignored otherwise. Provides the active color when using 'colorVariable'. May be a named color, constant values, or per-channel variables.
- colorVariable: Optional. Names a variable that is used to blend between 'activeColor' and 'passiveColor'.
- colorRange: Optional. Ignored if 'colorVariable' is not present. When present, 'colorVariable' operates in Threshold Mode, or Blend Mode if 'colorBlend' is true.
- colorBlend: Optional. Ignored if 'colorRange' is not present. When present, 'colorVariable' operates in Blend Mode.
- tiling: Optional. Defaults to (1, 1). Controls the UV scaling of the image. A value of 2, for instance, indicates that the texture will repeat 2x along that axis. May be constant or variable.
- uvShift: Optional. Default to (0, 0). Allows a UV shift to be applied to the texture. Shifts may be done along both axes, and either or both values may be a constant or a variable.
- wrap: Optional. When present, overrides the UV wrap mode for the selected texture. By default, textures default to 'wrap' equal to 'true'. Caution: Because of the way textures are accessed, setting this value affects all places where the named texture is used. It is not possible to apply 'wrap = true' and 'wrap = false' to the same texture in different parts of the config files.
A Line Graph node is used to visualize numeric data using a line graph. The graph updates regularly, with the x-axis representing time (at one second per pixel) and the y-axis representing the data being tracked (with the value per pixel defined by the sourceRange and graph size).
Note that the width of the graph and the sample rate affect the memory and performance of this node: the node tracks a number of samples equal to the width divided by the sample rate, and once the graph is full, the older values are moved in memory. Many detailed graphs may cause some lag.
LINE_GRAPH
{
name = Atmosphere Altitude
position = 16, 16
size = 480, 240
source = fc.Altitude()
sourceRange = 0, fc.AtmosphereTop()
sourceColor = 0,160,182,255
sampleRate = 1
borderWidth = 2
borderColor = 0, 80, 91,255
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The pixel offset from the upper-left corner of the page for this graph.
- size: Required. Specifies the desired pixel width and height of the graph.
- source: Required. The variable that will be graphed.
- sourceRange: Required. The values for the bottom and top of the y-axis.
- sourceColor: Required. The color of the line graph.
- sampleRate: Required. How frequently the variable will be sampled. Values below 1 will be clamped to 1.
- borderWidth: Optional. Required if 'borderColor' is present. The width in pixels for a border surrounding the graph area. This border is placed outside the region specified by 'position' and 'size'. In the above example, the border is 2 pixels wide, which means it is in x-position 14-16 and 496-498.
- borderColor: Optional. Required if 'borderWidth' is present. The color of the graph's border.
- variable: Optional. When present, the variable will control whether this graph is rendered or not.
A Line String nodes draws an arbitrary sequence of connected lines. It can be used to draw simple line segments using two vertices, or more complex shapes using multiple vertices. The line string is extremely configurable, allowing variables to alter the start color and line width, end color and line width, and vertex positions along the string.
Because this node generates a line string, it can be used to generate closed polygons (triangles, rectangles, etc.) by setting 'loop=true'.
Line strings may also use a texture to apply effects, such as a dotted line. The texture is applied with the U coordinate increasing between vertices, while the V coordinate increases across the width of the line. MAS adjusts the texture scale to attempt to keep the displayed texture at a 1:1 scale along the U direction (that is, if the texture is 32 pixels long, MAS will try to adjust the texture's scaling so it repeats every 32 pixels of line length).
There is no arbitrary limit to the number of vertices that can be included in a line string.
NOTE: KSP 1.3 uses Unity 5.4. The Unity 5.4 LineRenderer object that Line String uses has two bugs that affect the line quality. First, some segments of the line string have coordinates crossed so the line segment looks like a bowtie (it gets narrow in the middle). Second, the UV scaling is not perfect if the line segments have different lengths. It appears that the LineRenderer object divides the texture scaling across the segments of the line string, so the texture repeats the same amount in each segment. KSP 1.4 updated to Unity 2017.1, so these issues may have been fixed.
LINE_STRING
{
name = Srf Prograde pitch line
position = 256, 256
//texture = path/to/texture
startColor = 155, 255, 155, 255
endColor = fc.GetThrottle() * 155, 255, 0, 255
startWidth = 3.5
//endWidth = 4.5
//loop = false
vertex = -62, fc.Remap(fc.PitchSurfacePrograde(), -8, 8, -62, 62)
vertex = 62, fc.Remap(fc.PitchSurfacePrograde(), -8, 8, -62, 62)
...
//variable = 1
//rotation = fc.GetRoll()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The pixel offset from the upper-left corner of the page for the origin of the line string.
- texture: Optional. A URI to a texture that will be applied to the line string.
- startColor: Required. The color of the line string at the first vertex. The line will smoothly blend from this color to 'endColor'.
- endColor: Optional. Defaults to 'startColor'. The color of the line string at the last vertex.
- startWidth: Required. The width of the line string (in pixels) at the first vertex. The line will smoothly blend from this width to 'endWidth'.
- endWidth: Optional. Defaults to 'startWidth'. The width of the line string (in pixels) at the last vertex.
- loop: Optional. Defaults to false. When true, the Line String will automatically generate a line segment between the last vertex and the first vertex. This allows the config maker to avoid having to duplicate the first vertex as the last vertex.
- vertex: Minimum of two required. More than two, optional. Provides the (x, y) offset from 'position' for each vertex in the line string.
- variable: Optional. When present, the variable will control whether this line string is rendered or not.
- rotation: Optional. When present, the 'rotation' variable will rotate all of the line strings around 'position'.
A Menu node is used to create interactive text consisting of one or more menu items. Cursor keys can be designated to change which item is currently selected, and an 'enter' key can be designated to trigger an action based on the current selection. Menus could be used to toggle action groups or select targets. They may also be used to provide a hierarchical series of nested menus.
Menus may be configured in one of two ways - either as a static menu or as a dynamic menu. A static menu is a menu that consists of one or more ITEM
nodes. The total number of entries in the menu is determined by the number of ITEM
nodes in the menu's configuration. A dynamic menu is one whose size is not pre-determined. Instead, the itemCount
variable tells MAS how many menu items there are in the menu, and there is a single ITEM
node. itemCount
may change during play, so it can be used for target selection menus. A dynamic menu may also be used to design a more compact action groups menu or Celestial Body target menu.
MENU
{
name = Action Group menu
position = 0, 5
//variable = fc.GetSAS()
maxLines = 10
upSoftkey = 25
downSoftkey = 26
enterSoftkey = 22
homeSoftkey = 101
endSoftkey = 102
cursorPersistentName = %AUTOID%-StandbyMenu
cursor = >
cursorColor = COLOR_MFD2_TEXT_HIGHLIGHT
itemPositionShift = 2
//itemCount = fc.Variable()
ITEM
{
...
}
...
}
- name: Optional. Default '(anonymous)'. A name for the node.
- font: Optional. The name of the font to use for rendering this menu. If this parameter is omitted, the font listed in the MASMonitor config section is used.
-
style: Optional. Default 'Normal'. The style of font to use, if available. Valid options are
Normal
(the default),Bold
,Italic
, andBoldAndItalic
. Note that the use of Formatted Rich Text tags that change the style will override thestyle
field. - fontSize: Optional. The width and height of the menu's text as rendered on the screen, in pixels. If it is omitted, the default from MASMonitor is used.
- position: Optional. Default (0, 0). An offset from the upper-left corner for the menu. The offset is in units of character columns and rows, not pixels. The row and column size is based on the 'fontSize' of the MASMonitor, not the optional 'fontSize' specified in the MENU node.
- variable: Optional. When present, the variable will control whether this menu is rendered or not.
- maxLines: Required. Indicates the maximum number of menu items that will be displayed. Additional menu items may be accessed using the up/down/home/end keys. If there are fewer menu items than 'maxLines' allows, the MENU will treat the number of menu items as maxLines.
- upSoftkey: Optional. When present, identifies the softkey used to move the cursor up one menu item. Note that the cursor 'wraps around', so if the cursor is on the first menu item and the up key is pressed, the cursor moves to the last item.
- downSoftkey: Optional. When present, identifies the softkey used to move the cursor down one menu item. The note about wrapping around mentioned in 'upSoftkey' applies to the down movement, as well.
- homeSoftkey: Optional. When present, identifies the softkey used to move the cursor to the very first menu item.
- endSoftkey: Optional. When present, identifies the softkey used to move the cursor to the very last menu item.
- enterSoftkey: Optional. When present, identifies the softkey used to trigger actions on the selected menu item.
- cursorPersistentName: Required. Tells the MENU which persistent value is used to keep track of the cursor position. A persistent is used to allow the menu selection to persist between game sessions.
- cursor: Optional. Designates a text string that is used to show the current cursor location. Note that the cursor may be any sort of text, including using variables.
- cursorColor: Optional. Defaults to the monitor's default text color. Selects the color of the cursor text.
- itemPositionShift: Optional. Defaults to 0. Tells the MENU how far to offset the ITEM text from the left-most position. This shift is used so that a cursor is not drawn on top of the item text.
- itemCount: Optional. When present, the MENU is configured as a dynamic menu instead of a static menu.
A Menu includes one or more ITEM nodes (a dynamic menu must include exactly one ITEM). These Item nodes control what text is displayed in the menu, and they control what actions are taken when the menu is selected.
A menu item has three different states it can be in. 'Active' is the default state. 'Passive' is the state when the optional 'activeVariable' is false. 'Disabled' is the state when the optional 'enabledVariable' is false. When a menu item is disabled, the 'selectEvent' is ignored.
If there is no 'enabledVariable', then the menu item is never disabled, and it will always display either the 'activeText' or 'passiveText'.
If there is no 'activeVariable', then the menu item is always active (although it may still be disabled if there is an 'enabledVariable').
The keyword %ITEMID% may be used in ITEM variables. This ID is always a number from 0 to 'itemCount' - 1 (or, if 'itemCount' is not present, from 0 to the number of ITEM nodes in the menu, - 1). This keyword may be used for various things, such as using activeVariable = fc.GetPersistentAsNumber("%AUTOID%-StandbyMenu") == %ITEMID%
to highlight the text of the active item. Or, selectEvent = fc.ToggleActionGroup(%ITEMID%)
could be used to toggle the action group corresponding to the current item.
ITEM
{
name = AG 1
activeText = <=0=> $&$ fc.ActionGroupActiveMemo(1)
activeColor = COLOR_MFD2_TEXT_HIGHLIGHT
activeVariable = fc.GetActionGroup(1)
//passiveText = Passive Text
passiveColor = COLOR_MFD2_TEXT
disabledText = No Action Group 1
disabledColor = 128, 128, 128, 255
enabledVariable = fc.ActionGroupHasActions(1)
selectEvent = fc.ToggleActionGroup(1)
}
- name: Optional. Default '(anonymous)'. A name for the node.
- activeText: Required. The text displayed when the node is active.
- activeColor: Optional. Defaults to the default monitor color. The color used when the menu is active.
- activeVariable: Optional. When present, controls when the menu item switches between active and passive mode.
- passiveText: Optional. Defaults to 'activeText'. The text displayed when the node is passive.
- passiveColor: Optional. Defaults to the default monitor color. The color used when the menu is passive.
- enabledVariable: Optional. When present, controls when the menu is enabled (active or passive) instead of disabled.
- disabledText: Optional. Defaults to 'activeText' or 'passiveText'. Text displayed when the node is disabled.
- disabledColor: Optional. Ignored if 'disabledText' is not present. Defaults to the default monitor color. The color of 'disabledText'.
- selectEvent: Optional. The event that is executed when the 'enterSoftkey' is pressed while the item is selected. The 'selectEvent' field may be omitted to display informational fields in a menu.
A NavBall node is used to render a navball on the monitor. This can be used to create a primary flight display, or, with the right configuration, a 3D spherical HUD navigation aid.
Note that MAS does not include a NavBall model and texture. The example below assumes that RPM is installed. The ASET Props pack also includes a navball model.
NAVBALL
{
name = PFD navball
model = JSI/RasterPropMonitor/Library/Components/NavBall/NavBall
texture = JSI/RasterPropMonitor/Library/Components/NavBall/NavBall000
position = 256, 256
size = 340, 340
//iconScale = 1.0
//opacity = 0.9
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- model: Required. The URI to the navball model. While this is typically a simple sphere, there is no requirement to use a ball for this component.
- texture: Required. The texture that is applied to the navball model.
- position: Required. The 'position' is the center of the navball.
- size: Required. Specifies the pixel width and height of the image. Note that the navball is rendered to a square, so using a non-square size here will distort the shape of the navball.
-
iconScale: Optional. Default 1.0. Controls the relative size of the icons on the navball. An
iconScale
of 1.0 is approximately 1/6 the size of the navball. - opacity: Optional. Defaults to 1.0. Controls the alpha value of the navball. Setting this value less than one will make the navball partially transparent.
- variable: Optional. When present, the variable will control whether the navball is rendered or not.
Still under development, details may change
The Orbit Display node behaves similarly to the JSIOrbitDisplay in RasterPropMonitor. It is used to draw ellipses representing the current vessel's orbit, the orbit of its target, the resulting orbit of any planned maneuver node, and a representation of the body the vessel currently orbits. The MAS Orbit Display is more advanced than the RPM module, and it contains more configuration options as well.
ORBIT_DISPLAY
{
name = Orbital Schematic
position = 0, 432
size = 1024, 512
vertexCount = 32
orbitWidth = 3
bodyWidth = 5
vesselStartColor = COLOR_XKCD_KSPUNNAMEDCYAN
vesselEndColor = 95, 189, 185, 127 // KSPUNNAMEDCYAN with 50% alpha
targetStartColor = 255, 0, 255, 255
targetEndColor = 255, 0, 255, 127
maneuverStartColor = COLOR_XKCD_KSPNOTSOGOODORANGE
maneuverEndColor = 255, 176, 0, 127 // 50% alpha for COLOR_XKCD_KSPNOTSOGOODORANGE
//bodyColor = 255, 255, 255, 255
//atmoColor = 255, 255, 255, 255
//variable = MyEnableThis()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Optional. Default (0, 0). The upper left corner of the location where the orbits will display.
- size: Required. Specifies the pixel width and height of the region used to display the orbits. Since the Orbit Display uses a render texture, best results will be given if the width and height are powers of 2 (although they may be different).
- vertexCount: Required, must be at least 3. The number of vertices used to draw the orbit ellipses and planetary bodies. The larger the value, the smoother the curves, but the more computations required to update everything.
- orbitWidth: Optional, default 1. The width of the lines used to draw orbits, in pixels.
- bodyWidth: Optional, default 1. The width of the lines used to draw the current body and its atmosphere, in pixels.
- vesselStartColor: Optional, default white. The color of the line used to represent the beginning of the current vessel's orbit.
-
vesselEndColor: Optional, default
vesselStartColor
. The color used to represent the end of the current vessel's orbit. If thevesselEndColor
is omitted, the orbit is drawn in one color. Otherwise, the orbit fades fromvesselStartColor
at the vessel's current location tovesselEndColor
at the end of one orbit (or the end of the current orbital patch). -
targetStartColor, targetEndColor: Optional, default white and
targetStartColor
, respectively. Behaves the same as the vessel start and end color, but applies to target orbit paths. -
maneuverStartColor, maneuverEndColor: Optional, default white and
maneuverStartColor
, respectively. Behaves the same as the vessel start and end color, but applies to post-maneuver orbit paths. - bodyColor: Optional, default automatic color. When present, this color is always used to render the body that the vessel currently orbits. When it is omitted, MAS automatically selects a color based on the body currently being orbited.
- atmoColor: Optional, default automatic color. When present, this color is always used to render the edge of the atmosphere (when present) of the body the vessel currently orbits. When it is omitted, MAS selects a color based on the atmosphere's ambient color.
- variable: Optional. When present, the variable will control whether the orbit schematic is rendered or not.
A Polygon node provides a way to make arbitrary two-dimensional filled primitives (triangles, squares, or more complex shapes). There are some caveats to using these polygons:
- Vertex order matters. MAS must slice the polygon into a series of triangles, and if the vertices are wound the wrong way, they are not visible. Polygon vertices must be specified with a counter-clockwise ordering as viewed on the MFD display. Remember that MASMonitor uses a left-handed coordinate system (the top-left corner is 0, 0). If your polygon is not visible when it should be, you most likely wound the polygon the wrong way.
- Polygons are solid-filled only. They do not support multiple (or per-vertex) colors, and they do not support texturing.
- Polygons that have "bowties" where the vertices cross over may or may not render correctly.
The first two restrictions may be relaxed in future updates. The third restriction is a side-effect of the algorithm used to slice the polygon into triangles.
POLYGON
{
name = poly
position = 64, 96
color = 0, 255, 255, 255
rotation = -90 * fc.GetThrottle()
vertex = 0, 32
vertex = 64, 32
vertex = 128 + 32 * fc.GetThrottle(), 0
vertex = 64, -32
vertex = 0, -32
//variable = MyEnableThis()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The screen position for the origin of the polygon's coordinates.
- color: Required. Defines the color of the polygon.
- rotation: Optional. Default 0. The variable that controls the rotation of the polygon. The polygon is rotated around the origin as defined by 'position'.
- vertex: Required, minimum 3. The vertices of the polygon. Each vertex position may be a constant or a numeric variable.
- variable: Optional. When present, the variable will control if the polygon is rendered.
A Rolling Digit node renders numeric values while emulating a scrolling mechanical odometer for the least significant digit(s). Many of the configuration options are similar to a Text node.
Rolling Digits consist of two components - the static digits and the rolling digits. The static digits are the left-most digits. They update instantly when they change. The rolling digits are the last 1 or more digits (depending on the configuration). They simulate rotating, as if they were on a mechanical drum, which can provide a visual representation of the fractional value of the number.
A Rolling Digit will clamp 'value' so that it can not exceed 'maxDigits' character. For instance, if 'maxDigits' is 3, then the largest number that will be displayed is 999. The smallest number if -99 (because of the sign).
If 'numRolling' is larger than 1, then the Rolling Digit display will round values - for instance, if 'numRolling' is 2, the rolling digits will be '10', '20', '30', etc. MAS does not roll the tens column and the ones column separately.
The input 'value' is displayed in units. Fractional values will affect the position of the rolling digits, but they will not be displayed. If you want to show a fractional value, then 'value' needs to be multiplied by the appropriate amount. For instance, to display vertical speed including tenths of a m/s, 'value' would be fc.VerticalSpeed() * 10
.
ROLLING_DIGIT
{
name = Altimeter
position = 4, 5
maxDigits = 6
numRolling = 1
padZero = false
value = fc.Altitude()
//font =
//style =
//fontSize =
textColor = COLOR_MFD2_TEXT_HIGHLIGHT
//variable = 1
}
- name: Optional. Default '(anonymous)'. A name for the node.
- maxDigits: Required. The maximum number of digits that will be drawn. Values that do not fit within this limitation are clamped.
- numRolling: Required, must be at least 1. The number of digits that should be animated. See the description above for behavior when the 'numRolling' is 2 or larger.
- padZero: Optional. Default 'false'. When true, the static digits will be zero padded (for instance, they will display a '0000' instead of ' 0').
- value: Required. The variable whose value is displayed by the Rolling Digit.
- position: Optional. Default (0, 0). An offset from the upper-left corner for the text being rendered. The offset is in units of character columns and rows, not pixels. The row and column size is based on the 'fontSize' of the MASMonitor, not the optional 'fontSize' specified in the ROLLING_DIGIT node.
- font: Optional. The name of the font to use for rendering this text. If this parameter is omitted, the font listed in the MASMonitor config section is used.
-
style: Optional. Default 'Normal'. The style of font to use, if available. Valid options are
Normal
(the default),Bold
,Italic
, andBoldAndItalic
. - fontSize: Optional. The width and height of this text as rendered on the screen, in pixels. If it is omitted, the default from MASMonitor is used.
- textColor: Optional. The default text color for this text. If the entry is omitted, the default found in MASMonitor is used.
- variable: Optional. When present, the variable will control whether this text is rendered or not.
The RPM Module node provides a way to interact with legacy RasterPropMonitor mod bridge components. In RPM, a mod can provide a number of methods in a module, and RPM would call those methods to render images or text on one of its own monitors.
MAS is able to reproduce that behavior, although the prop config maker will need to take some additional steps, since MAS does not include RPM's 'magic' module instantiation code.
The first important difference is that the config maker must include the internal modules that the monitor uses in the prop's configuration. MAS does not add those modules at run time. If the module is not already present in the prop, that module will be treated as non-functional.
To add the module configuration, simply copy the BACKGROUNDHANDLER
OR PAGEHANDLER
from an RPM config, change the node name to MODULE
, and add it to the prop. Note that some mods, such as DPAI, have both BACKGROUNDHANDLER
and PAGEHANDLER
nodes. Include only the one that has most of the data. You do not need to include two MODULEs.
One way to add the modules is to use a Module Manager config, such as:
@PROP[MAS_ALCOR_MFD1]:NEEDS[SCANsat]
{
MODULE
{
name = JSISCANsatRPM
buttonUp = 0
buttonDown = 1
buttonEnter = 2
buttonEsc = 3
buttonHome = 4
buttonRight = 5
buttonLeft = 6
buttonR9 = 7
buttonR10 = 8
mapDivider = 2
resourceInterpolation = 4
zoomModifier = 2.0
iconPixelSize = 16
iconShadowShift = 2,2
scaleBarPosition = 16,144
scaleBar = JSI/RasterPropMonitor/Library/Textures/scalebar
scaleLabels = JSI/RasterPropMonitor/Library/Textures/scaleLabels
}
}
The numbers used for the button events, such as buttonUp
, buttonDown
, etc, in the above example, correspond to softkey events passed to the monitor.
Note that you do not need to include any of the 'method' fields in this node. Those are added to RPM_MODULE
.
Add an RPM_MODULE
node to your page, as seen below. If there was a 'pageActiveMethod' or 'buttonClickMethod' in the RPM handler node, copy those to the RPM_MODULE
.
If the source node was a BACKGROUNDHANDLER
, copy the 'method' field to 'renderMethod' in RPM_MODULE. If the source node was a PAGEHANDLER
, you will need to use its 'method' field in a TEXT node (see TEXT).
The 'renderSize' field applies only if there is a 'renderMethod'. If the mod does not have a 'renderMethod', the following information does not apply.
The primary reason that the 'renderSize' field is used because some mods assumed MFDs were always 640x640, since the RPM example MFDs used those dimensions. If those mods render to a texture with different dimensions, part of the image will be missing.
If 'renderSize' is omitted, and the RPM module does not appear to render correctly, add 'renderSize = 640, 640' to the RPM_MODULE
configuration and see if the module renders correctly.
A second reason to use 'renderSize' is to change the aspect ratio of the image being displayed. One scenario where this may be handy is rendering SCANsat images on multiple pages of the same monitor using different aspect ratios (square on one page, rectangular on another). If the aspect ratio of 'renderSize' and 'size' are different, MAS will automatically crop and center the image before displaying it.
RPM_MODULE
{
name = Legacy SCANsat display
moduleName = JSISCANsatRPM
renderMethod = MapRenderer
buttonClickMethod = ButtonProcessor
pageActiveMethod = PageActive
//renderSize = 640, 640
texture = ASET/ASET_Props/MFDs/ScreenPlates/noscansat
position = 0, 0
size = 512, 512
}
- name: Optional. Default '(anonymous)'. A name for the node.
-
moduleName: Required. The name of the RPM bridge module. In an RPM config, this would be the 'name' for the
BACKGROUNDHANDLER
node orPAGEHANDLER
node. -
renderMethod: Optional. Most RPM bridge modules use a
BACKGROUNDHANDLER
to draw graphics for display on the MFD. The 'renderMethod' is the 'method' field from the correspondingBACKGROUNDHANDLER
node. -
buttonClickMethod: Optional. The 'buttonClickMethod' is used to notify the bridge mod of relevant button clicks. This field should be copied directly from the
BACKGROUNDHANDLER
node orPAGEHANDLER
node. -
pageActiveMethod: Optional. The 'pageActiveMethod' is used to notify the bridge mod when it is being displayed and needs to update itself, or when it is no longer being displayed. This field should be copied directly from the
BACKGROUNDHANDLER
node orPAGEHANDLER
node. - texture: Optional. A URI to the texture that will be displayed if the module listed in 'moduleName' is not found. If 'texture' is not provided and the module is not found, the rendered area will be black.
- position: Optional. Default (0,0). The pixel offset from the upper-left corner of the page.
- size: Optional. Defaults to the configured size of the monitor. Specifies the desired pixel width and height of the displayed image or text.
- renderSize: Optional. Defaults to 'size'. This is the size of the render texture that the 'renderMethod' will use. Please read the notes above to understand when and why you would use this field.
- variable: Optional. When present, the variable will control whether this node is rendered or not.
A Sub-Page node allows the MASMonitor page designer to create a library of commonly-used MAS_PAGE nodes. This library may be shared by multiple pages, so that the designer can make edits to the sub-page and have those edits apply to all pages that use that sub-page. A second benefit of a sub-page is that it allows an entire group of nodes to be moved by editing a single position
field. For an example, look at 'Orbit Map 640x320' in MOARdV/MFD/SubPage_Common.cfg. There are 21 components in that sub-page, so repositioning the orbit map on a page requires a significant amount of editing if they're not contained in the sub-page. Using the sub-page allows that entire component to be moved by editing a single position
.
The nodes that are added by a sub-page will be placed in order where the SUB_PAGE node occurs in the page. That is, any node listed before the SUB_PAGE will be considered "below" the nodes of the sub-page, and any node listed after the SUB_PAGE will be "above" the nodes of the sub-page.
A SUB_PAGE may be nested within another SUB_PAGE. However, beware that it is possible to create an infinite recursion by having sub pages include each other. This may cause KSP to crash!
SUB_PAGE
{
name = My SubPage
//position = 0, 0
//variable = 1
}
- name: Required. Unlike other page nodes, a name must be included in a SUB_PAGE. This name must match the name of a MAS_SUB_PAGE node.
- position: Optional. When present, this field provides an offset in pixels that is applied to all components in the MAS_SUB_PAGE node. Note that adding a 'position' field to the SUB_PAGE will affect page initialization times when loading the vessel, so you should omit 'position' instead of using 'position = 0, 0'.
- variable: Optional. When present, this field can be used to control the visibility of all components in the SUB_PAGE. MAS will apply a logical AND to the variable when the nodes in the MAS_SUB_PAGE already have a variable of their own.
The MAS_SUB_PAGE is a top-level config file node, not a part of a MAS_PAGE. It consists of one or more MASPage component nodes, the same as a monitor page. These nodes will be inserted into a MAS_PAGE when a SUB_PAGE node with the same name is encountered.
Note that you may not nest sub-pages by including a SUB_PAGE node inside a MAS_SUB_PAGE. The nested SUB_PAGE will be ignored, and MAS will log an error.
MAS_SUB_PAGE
{
name = My SubPage
// One or more MASPage nodes.
}
- name: Required. The SUB_PAGE node in a page uses this name to specify the sub-page nodes to insert.
A Text node renders text. This text may be static (unchanging) data, or it may use variables. Simple text can be defined in the Text node using a 'text' field, while complex or multi-line text residing in a separate file may referenced with a 'textfile' field. All text supports Formatted Rich Text.
The Text node may also render text from a RasterPropModule bridge mod, such as the text overlay seen in the DPAI mode. For this configuration, the bridge mod needs to be configured as described in RPM_MODULE, and the 'method' field needs to be included in a 'textmethod' entry in the Text node.
These text nodes are not as complex as a Text Label - there are no controls for alignment, font size, anchors, etc. However, they still support Formatted Rich Text.
TEXT
{
name = Important Text Node
text = Hello, world!
//textfile = MOARdV/AvionicsSystems/Sample/helloworld.txt
//textmethod = DPAI_RPM:getPageText
//font = InconsolataGo
//style = Bold
//fontSize = 16, 32
//textColor = 0, 255, 0, 255
//position = 0,0
//variable = fc.GetRCS()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- text: Required if there is not a 'textfile' or a 'textmethod' entry. Text that is displayed for this node, similar to a Text Label action in MASComponent.
- textfile: Required if there is not a 'text' entry or a 'textmethod' entry; ignored if there is a 'text' field. Refers to a text file that contains the text that will be rendered.
-
textmethod: Required if there is not a 'text' entry or a 'textfile' entry; ignored if either of those entries are present. Refers to an RPM bridge plugin that can display text on the monitor. The 'textmethod' is formatted by applying the 'name' field from the RPM
PAGEHANDLER
node, followed be a ':', followed by the 'method' from thePAGEHANDLER
, such astextmethod = DPAI_RPM:getPageText
. The 'textfile' is usually the better choice for multi-line text. - font: Optional. The name of the font to use for rendering this text. If this parameter is omitted, the font listed in the MASMonitor config section is used.
-
style: Optional. Default 'Normal'. The style of font to use, if available. Valid options are
Normal
(the default),Bold
,Italic
, andBoldAndItalic
. Note that the use of Formatted Rich Text tags that change the style will override thestyle
field. - fontSize: Optional. The width and height of this text as rendered on the screen, in pixels. If it is omitted, the default from MASMonitor is used.
- textColor: Optional. The default text color for this text. If the entry is omitted, the default found in MASMonitor is used.
- position: Optional. Default (0, 0). An offset from the upper-left corner for the text being rendered. The offset is in units of character columns and rows, not pixels. The row and column size is based on the 'fontSize' of the MASMonitor, not the optional 'fontSize' specified in the TEXT node.
- variable: Optional. When present, the variable will control whether this text is rendered or not.
A Vertical Bar node renders a bar graph that grows or shrinks vertically in response to the source variable. The bar graph may be a solid color, or it may use a texture, as described in the Horizontal Bar entry.
VERTICAL_BAR
{
name = VSI
position = 256, 272
size = 32, 128
source = fc.PseudoLog10(fc.VerticalSpeed())
sourceRange = -5, 5
sourceColor = 64,192,64,255
anchor = Middle
//texture = AvionicsSystems/Textures/horiz_bargraph
borderWidth = 2.5
borderColor = 64, 255, 64,255
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- position: Required. The location on the monitor where the upper-left corner of the bar graph will be placed.
- size: Required. The size of the graph.
- source: Required. The variable that will be graphed.
- sourceRange: Required. The values for the bottom and top ends of the bar.
- sourceColor: Optional. Defaults to white. The color of the bar graph.
- texture: Optional. When present, the named texture is drawn so it will fill the graph's area. Color textures may be used - the sourceColor is multiplied by the texture color in that case. If no texture is provided, the graph is treated as a solid color.
- anchor: Optional. Defaults to 'Bottom'. Defines the anchor of the bar graph. 'Bottom' means the bottom side of the region, in which case the graph grows towards the top. 'Top' means the opposite: the graph starts on the top and it grows to the bottom. 'Middle' mwans the graph starts in the center, and it grows to the bottom if the source value is below 1/2 of the range, or it grows to the top if the source value is above 1/2 of the range.
- borderWidth: Optional. Required if 'borderColor' is present. The width in pixels for a border surrounding the graph area. This border is placed outside the region specified by 'position' and 'size'.
- borderColor: Optional. Required if 'borderWidth' is present. The color of the graph's border.
- variable: Optional. When present, the variable will control whether this strip is rendered or not.
A Vertical Strip node renders part of a texture in response to a variable input. It can be used for a aircraft VSI and altitude strips on a HUD or other applications. The full width of the source texture is always displayed in a vertical strip, but only a portion of the height is visible at any given time.
VERTICAL_STRIP
{
name = VSI
texture = JSI/RasterPropMonitor/Library/Components/HUD/leftscale
position = 86,64
size = 64,320
input = fc.PseudoLog10(fc.VerticalSpeed())
inputRange = -5, 5
displayRange = 1845,208
displayHeight = 640
//wrap = false
//variable = fc.GetBrakes()
}
- name: Optional. Default '(anonymous)'. A name for the node.
- texture: Required. The texture that will be used for the horizontal strip.
- position: Required. The location on the monitor where the upper-left corner of the strip will be placed.
- size: Required. The size of displayed portion of the strip.
- input: Required. The variable that will be used to control the strip.
- inputRange: Required. The range of values that will affect the position of the displayed strip. The result of 'input' is clamped to this range.
- displayRange: Required. Controls how the 'inputRange' is mapped to texture locations. Lists the position in pixels for the lower and upper bound of the displayed image. Pixels count up from the top of the image (the top of the image is '0', the bottom is whatever the height of the image is).
- displayHeight: Required. The height of the visible portion of 'texture', in pixels as measured on the texture. Eg, if the texture is 512 pixels tall, and you want the 25% of it visible, you would use 'displayHeight = 128'.
- wrap: Optional. Default false. When true, indicates that the texture is expected to wrap around (like a continuous ribbon). When false, the texture coordinates are clamped to the ends of the texture.
- variable: Optional. When present, the variable will control whether this strip is rendered or not.
A Viewport node allows the IVA designer to mask out parts of the data displayed below it. Primary uses are for masking complex lines or graphics that are supposed to be constrained within a certain portion of the screen.
The viewport is a rectangle defined by of two corners, the upper-left and lower-right. Anything that is listed earlier than the viewport in the page definition will be obstructed by the viewport, unless it falls inside the bounds of the viewport's rectangle.
VIEWPORT
{
name = Test Viewport
upperLeftCorner = 128, 128
lowerRightCorner = 384, 256 + 256 * fc.GetThrottle()
color = 128, 128, 0, 255
//variable =
}
- name: Optional. Default '(anonymous)'. A name for the node.
- upperLeftCorner: Required. Describes the upper-left corner of the viewport. Note that either or both parameter may be a variable.
- lowerRightCorner: Required. Describes the lower-right corner of the viewport. Note that either or both parameter may be a variable.
- color: Optional. Defaults to (0, 0, 0, 255). The color of the viewport mask. Any channel may be a variable.
- variable: Optional. When present, the variable will control whether or not the viewport is enabled.