Alarms#
- class SpaceCenter.AlarmManager()#
Alarm manager. Obtained by calling
SpaceCenter.getAlarmManager().- AlarmManager.getAlarms()#
A list of all alarms.
- Property:
Read-only, cannot be set
- Return type:
ArrayofSpaceCenter.Alarm
- AlarmManager.alarmsWithType(type)#
A list of all alarms of the given type.
- Arguments:
type (
SpaceCenter.AlarmType) – The type of alarm to return.
- Return type:
ArrayofSpaceCenter.Alarm
- AlarmManager.alarmWithName(name)#
Returns the first alarm with the given title, or
nullif 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.- Arguments:
name (
string) – The title of the alarm to return.
- Return type:
SpaceCenter.Alarmornull
- AlarmManager.addAlarm(time[, title[, description]])#
Create an alarm.
- Arguments:
time (
number) – Number of seconds from now that the alarm should trigger.title (
string) – Title for the alarm. Defaults to"Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
- AlarmManager.addVesselAlarm(time, vessel[, title[, description]])#
Create an alarm linked to a vessel.
- Arguments:
time (
number) – Number of seconds from now that the alarm should trigger.vessel (
SpaceCenter.Vessel) – Vessel to link the alarm to.title (
string) – Title for the alarm. Defaults to"Vessel Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
- AlarmManager.addApoapsisAlarm(vessel[, offset[, title[, description]]])#
Create an alarm for the given vessel’s next apoapsis.
- Arguments:
vessel (
SpaceCenter.Vessel) – The vessel.offset (
number) – Time in seconds to offset the alarm by. Defaults to60.0.title (
string) – Title for the alarm. Defaults to"Apoapsis Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
- AlarmManager.addPeriapsisAlarm(vessel[, offset[, title[, description]]])#
Create an alarm for the given vessel’s next periapsis.
- Arguments:
vessel (
SpaceCenter.Vessel) – The vessel.offset (
number) – Time in seconds to offset the alarm by. Defaults to60.0.title (
string) – Title for the alarm. Defaults to"Periapsis Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
- AlarmManager.addManeuverNodeAlarm(vessel, node[, offset[, addBurnTime[, title[, description]]]])#
Create an alarm for the given vessel and maneuver node.
- Arguments:
vessel (
SpaceCenter.Vessel) – The vessel.node (
SpaceCenter.Node) – The maneuver node.offset (
number) – Time in seconds to offset the alarm by. Defaults to60.0.addBurnTime (
boolean) – Whether the node’s burn time should be included in the alarm. Defaults totrue.title (
string) – Title for the alarm. Defaults to"Maneuver Node Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
- AlarmManager.addSOIAlarm(vessel[, offset[, title[, description]]])#
Create an alarm for the given vessel’s next sphere of influence change.
- Arguments:
vessel (
SpaceCenter.Vessel) – The vessel.offset (
number) – Time in seconds to offset the alarm by. Defaults to60.0.title (
string) – Title for the alarm. Defaults to"SOI Change Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
- AlarmManager.addTransferWindowAlarm(vessel, target[, title[, description]])#
Create an alarm for the next planetary transfer window from the vessel’s current parent body to the target body.
- Arguments:
vessel (
SpaceCenter.Vessel) – The vessel.target (
SpaceCenter.CelestialBody) – The target body.title (
string) – Title for the alarm. Defaults to"Transfer Window Alarm".description (
string) – Description for the alarm. Defaults to"".
- Return type:
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 SpaceCenter.Alarm()#
An alarm. Can be accessed using
SpaceCenter.getAlarmManager().- Alarm.getID()#
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.
- Property:
Read-only, cannot be set
- Return type:
number
- Alarm.getType()#
Type of alarm.
- Property:
Read-only, cannot be set
- Return type:
- Alarm.getTitle()#
- Alarm.setTitle(value)#
Title of the alarm.
- Property:
Can be read or written
- Return type:
string
- Alarm.getDescription()#
- Alarm.setDescription(value)#
Description of the alarm.
- Property:
Can be read or written
- Return type:
string
- Alarm.getTime()#
- Alarm.setTime(value)#
Time the alarm will trigger, in seconds since epoch.
- Property:
Can be read or written
- Return type:
number
- Alarm.getTimeUntil()#
Time until the alarm triggers, in seconds.
- Property:
Read-only, cannot be set
- Return type:
number
- Alarm.getEventOffset()#
- Alarm.setEventOffset(value)#
Seconds between the alarm going off and the event it references.
- Property:
Can be read or written
- Return type:
number
Note
For a maneuver alarm that includes the burn time, setting this sets the margin before the start of the burn, and the value read back includes half the burn time.
- Alarm.getVessel()#
Vessel the alarm references.
nullif it does not reference a vessel.- Property:
Read-only, cannot be set
- Return type:
SpaceCenter.Vesselornull
- Alarm.getNode()#
- Alarm.setNode(value)#
Maneuver node the alarm references. Only valid for alarms of type
SpaceCenter.AlarmType.maneuver.- Property:
Can be read or written
- Return type:
Note
Throws an exception if the alarm is not of type
SpaceCenter.AlarmType.maneuver.
- Alarm.getOriginBody()#
- Alarm.setOriginBody(value)#
Origin body for the transfer window. Only valid for alarms of type
SpaceCenter.AlarmType.transferWindow.- Property:
Can be read or written
- Return type:
Note
Throws an exception if the alarm is not of type
SpaceCenter.AlarmType.transferWindow.
- Alarm.getDestinationBody()#
- Alarm.setDestinationBody(value)#
Destination body for the transfer window. Only valid for alarms of type
SpaceCenter.AlarmType.transferWindow.- Property:
Can be read or written
- Return type:
Note
Throws an exception if the alarm is not of type
SpaceCenter.AlarmType.transferWindow.
- Alarm.getWarpAction()#
- Alarm.setWarpAction(value)#
The action taken on time warp when the alarm fires.
- Property:
Can be read or written
- Return type:
- Alarm.getMessageAction()#
- Alarm.setMessageAction(value)#
The on-screen message behavior when the alarm fires.
- Property:
Can be read or written
- Return type:
- Alarm.getPlaySound()#
- Alarm.setPlaySound(value)#
Whether the alarm plays a sound when it fires.
- Property:
Can be read or written
- Return type:
boolean
- Alarm.getDeleteOnDismiss()#
- Alarm.setDeleteOnDismiss(value)#
Whether the alarm is deleted automatically once the player has dismissed the triggered message.
- Property:
Can be read or written
- Return type:
boolean
- Alarm.getTriggered()#
Whether the time of the alarm has passed and its actions have been triggered.
- Property:
Read-only, cannot be set
- Return type:
boolean
- Alarm.getActioned()#
Whether the alarm’s actions were triggered and then completed or closed.
- Property:
Read-only, cannot be set
- Return type:
boolean
- Alarm.remove()#
Removes the alarm.
Note
Any further use of this object throws an exception.
- class SpaceCenter.AlarmType()#
The type of an alarm. See
SpaceCenter.Alarm.getType().- AlarmType.raw#
An alarm for a specific date/time or a specific period in the future.
- AlarmType.apoapsis#
An alarm for the next apoapsis of a vessel.
- AlarmType.periapsis#
An alarm for the next periapsis of a vessel.
- AlarmType.maneuver#
An alarm based on a maneuver node on the vessel’s flight path.
- AlarmType.soiChange#
An alarm for the next sphere of influence change on the vessel’s flight path.
- AlarmType.transferWindow#
An alarm for the next planetary transfer window from the vessel’s current orbit to a target body.
- AlarmType.unknown#
The alarm is of a type not recognized by kRPC. Typically this is a type introduced by a mod.
- class SpaceCenter.AlarmWarpAction()#
The warp action taken when an alarm fires. See
SpaceCenter.Alarm.getWarpAction().- AlarmWarpAction.noChange#
Do not change time warp when the alarm fires.
- AlarmWarpAction.stopWarp#
Drop out of time warp when the alarm fires.
- AlarmWarpAction.pauseGame#
Pause the game when the alarm fires.
- class SpaceCenter.AlarmMessageAction()#
The on-screen message action taken when an alarm fires. See
SpaceCenter.Alarm.getMessageAction().- AlarmMessageAction.noMessage#
Do not display a message when the alarm fires.
- AlarmMessageAction.message#
Display a message when the alarm fires.
- AlarmMessageAction.messageIfNotActiveVessel#
Display a message only if the alarm’s vessel is not the currently active vessel.