Kerbal Alarm Clock

You can find out if Kerbal Alarm Clock addon is available in the current game installation by usng the boolean expression addons:available("KAC").

Note that due to changes in Kerbal Alarm Clock, kOS can no longer support versions of KAC that are older than 3.0.0.2. The API that Kerbal Alarm Clock publishes for other mods to use changed such that kOS can ether support newer Kerbal Alarm Clock, or older Kerbal Alarm Clock, but not both.

The Kerbal Alarm Clock is a plugin that allows you to create reminder alarms at future periods to help you manage your flights and not warp past important times.

http://triggerau.github.io/KerbalAlarmClock/images/KACForumPic.png

Creator of the KAC provides API for integration with other mods. In KOS we provide limited access to KAC alarms via following structure and functions.

Access structure KACAddon via ADDONS:KAC.

structure KACAddon

Suffix

Type

Description

AVAILABLE

bool(readonly)

True if KAC is installed and KAC integration enabled. It is better to use addons:available("KAC") for this purpose.

ALARMS()

List

List all alarms

KACAddon:AVAILABLE
Type

bool

Access

Get only

It is better to use ADDONS:AVAILABLE("KAC") first to discover if KAC is installed.

True if KAC is installed and KAC integration enabled. Example of use:

if ADDONS:KAC:AVAILABLE
{
    //some KAC dependent code
}
KACAddon:ALARMS()
Returns

List of KACAlarm objects

List all the alarms set up in Kerbal Alarm Clock. Example of use:

for i in ADDONS:KAC:ALARMS
{
        print i:NAME + " - " + i:REMAINING + " - " + i:TYPE+ " - " + i:ACTION.
}
structure KACAlarm

Suffix

Type

Description

ID

string (readonly)

Unique identifier

NAME

string

Name of the alarm

ACTION

string

What should the Alarm Clock do when the alarm fires

TYPE

string (readonly)

What type of Alarm is this - affects icon displayed and some calc options

NOTES

string

Long description of the alarm (optional)

REMAINING

scalar (s)

Time remaining until alarm is triggered

REPEAT

boolean

Should the alarm be repeated once it fires

REPEATPERIOD

scalar (s)

How long after the alarm fires should the next alarm be set up

ORIGINBODY

string

Name of the body the vessel is departing from

TARGETBODY

string

Name of the body the vessel is arriving at

KACAlarm:ID
Type

string

Access

Get only

Unique identifier of the alarm.

KACAlarm:NAME
Type

string

Access

Get/Set

Name of the alarm. Displayed in main KAC window.

KACAlarm:ACTION
Type

string

Access

Get/Set

Should be one of the following

  • MessageOnly - Message Only-No Affect on warp

  • KillWarpOnly - Kill Warp Only-No Message

  • KillWarp - Kill Warp and Message

  • PauseGame - Pause Game and Message

If set incorrectly will log a warning in Debug log and revert to previous or default value.

KACAlarm:TYPE
Type

string

Access

Get only

Can only be set at Alarm creation. Could be one of the following as per API

  • Raw (default)

  • Maneuver

  • ManeuverAuto

  • Apoapsis

  • Periapsis

  • AscendingNode

  • DescendingNode

  • LaunchRendevous

  • Closest

  • SOIChange

  • SOIChangeAuto

  • Transfer

  • TransferModelled

  • Distance

  • Crew

  • EarthTime

Warning: Unless you are 100% certain you know what you’re doing, create only “Raw” AlarmTypes to avoid unnecessary complications.

KACAlarm:NOTES
Type

string

Access

Get/Set

Long description of the alarm. Can be seen when alarm pops or by double-clicking alarm in UI.

Warning: This field may be reserved in the future version of KAC-KOS integration for automated script execution upon triggering of the alarm.

KACAlarm:REMAINING
Type

scalar

Access

Get only

Time remaining until alarm is triggered.

KACAlarm:REPEAT
Type

boolean

Access

Get/Set

Should the alarm be repeated once it fires.

KACAlarm:REPEATPERIOD
Type

scalar

Access

Get/Set

How long after the alarm fires should the next alarm be set up.

KACAlarm:ORIGINBODY
Type

string

Access

Get/Set

Name of the body the vessel is departing from.

KACAlarm:TARGETBODY
Type

string

Access

Get/Set

Name of the body the vessel is arriving to.

Available Functions

Function

Description

ADDALARM(AlarmType, UT, Name, Notes)

Create new alarm of AlarmType at UT

LISTALARMS(alarmType)

List alarms with type alarmType.

DELETEALARM(alarmID)

Delete alarm with ID = alarmID

ADDALARM(AlarmType, UT, Name, Notes)

Creates alarm of type KACAlarm:ALARMTYPE at UT with Name and Notes attributes set. Attaches alarm to current CPU Vessel. Returns KACAlarm object if creation was successful and empty string otherwise:

set na to addAlarm("Raw",time:seconds+300, "Test", "Notes").
print na:NAME. //prints 'Test'
set na:NOTES to "New Description".
print na:NOTES. //prints 'New Description'
LISTALARMS(alarmType)

If alarmType equals “All”, returns List of all KACAlarm objects attached to current vessel or have no vessel attached. Otherwise returns List of all KACAlarm objects with KACAlarm:TYPE equeal to alarmType and attached to current vessel or have no vessel attached.:

set al to listAlarms("All").
for i in al
{
    print i:ID + " - " + i:name.
}
DELETEALARM(alarmID)

Deletes alarm with ID equal to alarmID. Returns True if successful, false otherwise:

set na to addAlarm("Raw",time:seconds+300, "Test", "Notes").
if (DELETEALARM(na:ID))
{
    print "Alarm Deleted".
}