Skip to main content

KSPSwitch

The KSPSwitch class allows you to connect to a ui_switch in KSP.

class KSPSwitch

Example​

import { KSPSwitch } from kontakt

var switch = KSPSwitch(id: "my_switch")

Constructor​

constructor(id: String)

Connects to a ui_switch in KSP with the given control ID.

Properties​

automate​

automate: Bool { get set }

Activate/Deactivate automation touch. Set this to true when interacting with a control to write automation. Set it back to false once the user interaction is finished.


checked​

checked: Bool { get set }

Whether the switch is checked.


connected​

connected: Bool { get }

Whether the control is connected. A control might not be connected if no corresponding control was found for the given id.


custom_id​

custom_id: Int { get }

The value of $CONTROL_PAR_CUSTOM_ID set on this control.


id​

id: String { get }

The KSP control ID this switch is connected to.


label​

label: String { get }

The value of $CONTROL_PAR_LABEL set on this control.


text (8.4)​

text: String { get }

The value of $CONTROL_PAR_TEXT set on this control.

Methods​

toggle​

toggle() -> ()

Toggles the checked state of the switch.