Alarms#

class AlarmManager#

Alarm manager. Obtained by calling alarm_manager.

alarms#

A list of all alarms.

Attribute:

Read-only, cannot be set

Return type:

list(Alarm)

alarms_with_type(type)#

A list of all alarms of the given type.

Parameters:

type (AlarmType) – The type of alarm to return.

Return type:

list(Alarm)

alarm_with_name(name)#

Returns the first alarm with the given title, or None if no such alarm exists. Alarm titles are not guaranteed to be unique; if more than one alarm shares the given title, the first one found is returned.

Parameters:

name (str) – The title of the alarm to return.

Return type:

Alarm

static add_alarm(time[, title='Alarm'][, description=''])#

Create an alarm.

Parameters:
  • time (float) – Number of seconds from now that the alarm should trigger.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

static add_vessel_alarm(time, vessel[, title='Vessel Alarm'][, description=''])#

Create an alarm linked to a vessel.

Parameters:
  • time (float) – Number of seconds from now that the alarm should trigger.

  • vessel (Vessel) – Vessel to link the alarm to.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

static add_apoapsis_alarm(vessel[, offset=60.0][, title='Apoapsis Alarm'][, description=''])#

Create an alarm for the given vessel’s next apoapsis.

Parameters:
  • vessel (Vessel) – The vessel.

  • offset (float) – Time in seconds to offset the alarm by.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

static add_periapsis_alarm(vessel[, offset=60.0][, title='Periapsis Alarm'][, description=''])#

Create an alarm for the given vessel’s next periapsis.

Parameters:
  • vessel (Vessel) – The vessel.

  • offset (float) – Time in seconds to offset the alarm by.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

static add_maneuver_node_alarm(vessel, node[, offset=60.0][, add_burn_time=True][, title='Maneuver Node Alarm'][, description=''])#

Create an alarm for the given vessel and maneuver node.

Parameters:
  • vessel (Vessel) – The vessel.

  • node (Node) – The maneuver node.

  • offset (float) – Time in seconds to offset the alarm by.

  • add_burn_time (bool) – Whether the node’s burn time should be included in the alarm.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

static add_soi_alarm(vessel[, offset=60.0][, title='SOI Change Alarm'][, description=''])#

Create an alarm for the given vessel’s next sphere of influence change.

Parameters:
  • vessel (Vessel) – The vessel.

  • offset (float) – Time in seconds to offset the alarm by.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

static add_transfer_window_alarm(vessel, target[, title='Transfer Window Alarm'][, description=''])#

Create an alarm for the next planetary transfer window from the vessel’s current parent body to the target body.

Parameters:
  • vessel (Vessel) – The vessel.

  • target (CelestialBody) – The target body.

  • title (str) – Title for the alarm.

  • description (str) – Description for the alarm.

Return type:

Alarm

Note

This relies on KSP’s stock transfer-window alarm logic. If KSP cannot compute a transfer from the vessel’s current parent body to the target, the resulting alarm may not fire at a useful time; in that case the properties on the returned alarm can still be used to inspect or adjust it.

class Alarm#

An alarm. Can be accessed using alarm_manager.

id#

Unique identifier of the alarm. KSP destroys and recreates an alarm when it is edited. This id will remain constant between the old and new alarms.

Attribute:

Read-only, cannot be set

Return type:

int

type#

Type of alarm.

Attribute:

Read-only, cannot be set

Return type:

AlarmType

title#

Title of the alarm.

Attribute:

Can be read or written

Return type:

str

description#

Description of the alarm.

Attribute:

Can be read or written

Return type:

str

time#

Time the alarm will trigger, in seconds since epoch.

Attribute:

Can be read or written

Return type:

float

time_until#

Time until the alarm triggers, in seconds.

Attribute:

Read-only, cannot be set

Return type:

float

event_offset#

Seconds between the alarm going off and the event it references.

Attribute:

Can be read or written

Return type:

float

vessel#

Vessel the alarm references. None if it does not reference a vessel.

Attribute:

Read-only, cannot be set

Return type:

Vessel

node#

Maneuver node the alarm references. Only valid for alarms of type AlarmType.maneuver.

Attribute:

Can be read or written

Return type:

Node

Note

Throws an exception if the alarm is not of type AlarmType.maneuver.

origin_body#

Origin body for the transfer window. Only valid for alarms of type AlarmType.transfer_window.

Attribute:

Can be read or written

Return type:

CelestialBody

Note

Throws an exception if the alarm is not of type AlarmType.transfer_window.

destination_body#

Destination body for the transfer window. Only valid for alarms of type AlarmType.transfer_window.

Attribute:

Can be read or written

Return type:

CelestialBody

Note

Throws an exception if the alarm is not of type AlarmType.transfer_window.

warp_action#

The action taken on time warp when the alarm fires.

Attribute:

Can be read or written

Return type:

AlarmWarpAction

message_action#

The on-screen message behavior when the alarm fires.

Attribute:

Can be read or written

Return type:

AlarmMessageAction

play_sound#

Whether the alarm plays a sound when it fires.

Attribute:

Can be read or written

Return type:

bool

delete_on_dismiss#

Whether the alarm is deleted automatically once the player has dismissed the triggered message.

Attribute:

Can be read or written

Return type:

bool

triggered#

Whether the time of the alarm has passed and its actions have been triggered.

Attribute:

Read-only, cannot be set

Return type:

bool

actioned#

Whether the alarm’s actions were triggered and then completed or closed.

Attribute:

Read-only, cannot be set

Return type:

bool

remove()#

Removes the alarm.

class AlarmType#

The type of an alarm. See Alarm.type.

raw#

An alarm for a specific date/time or a specific period in the future.

apoapsis#

An alarm for the next apoapsis of a vessel.

periapsis#

An alarm for the next periapsis of a vessel.

maneuver#

An alarm based on a maneuver node on the vessel’s flight path.

soi_change#

An alarm for the next sphere of influence change on the vessel’s flight path.

transfer_window#

An alarm for the next planetary transfer window from the vessel’s current orbit to a target body.

unknown#

The alarm is of a type not recognized by kRPC. Typically this is a type introduced by a mod.

class AlarmWarpAction#

The warp action taken when an alarm fires. See Alarm.warp_action.

no_change#

Do not change time warp when the alarm fires.

stop_warp#

Drop out of time warp when the alarm fires.

pause_game#

Pause the game when the alarm fires.

class AlarmMessageAction#

The on-screen message action taken when an alarm fires. See Alarm.message_action.

no_message#

Do not display a message when the alarm fires.

message#

Display a message when the alarm fires.

message_if_not_active_vessel#

Display a message only if the alarm’s vessel is not the currently active vessel.