Raster Prop Monitor#

Provides functionality to interact with the Raster Prop Monitor mod. Tested with Raster Prop Monitor 1.1.0.1.

Example#

kRPC adds a page named krpc to every Raster Prop Monitor screen. The page shows the screen’s Display, which a script draws on. The following example draws a page on the first screen in the active vessel’s IVA, showing whether SAS is on. The screen’s ENTER button toggles SAS, and its NAV button shows the page:

#include <algorithm>
#include <krpc.hpp>
#include <krpc/services/raster_prop_monitor.hpp>
#include <krpc/services/space_center.hpp>

int main() {
  krpc::Connection conn = krpc::connect("Raster Prop Monitor Example");
  krpc::services::SpaceCenter sc(conn);
  krpc::services::RasterPropMonitor rpm(conn);
  auto vessel = sc.active_vessel().value();
  auto control = vessel.control();

  // The first screen in the IVA, and the content of its krpc page
  auto monitor = rpm.monitors(vessel)[0];
  auto display = monitor.display();

  // Raster Prop Monitor formats the SAS variable, and keeps it up to date
  display.set_text("SAS: {0:ON;OFF;OFF} $&$ SAS");

  // A press of the NAV button shows the page
  monitor.capture_button("buttonR1", "krpc");

  // Each press of the ENTER button toggles SAS
  auto buttons = monitor.buttons();
  auto enter = std::find(buttons.begin(), buttons.end(), "button_ENTER");
  auto pressed = display.button_pressed(enter - buttons.begin());
  pressed.acquire();
  while (true) {
    pressed.wait();
    control.set_sas(!control.sas());
  }
}

The page text names Raster Prop Monitor’s SAS variable, and the format gives ON for 1 and OFF for 0. Raster Prop Monitor updates the page as SAS changes, however it is switched. On the screens of the Mk1 Lander Can, NAV is buttonR1.