Configuration of kOS¶
-
structure
Config
¶ Config
is a special structure that allows your kerboscript programs to set or get the values stored in the kOS plugin’s config file.The options here can also be set by using the user interface panel shown here. This control panel is part of the App Control Panel
In either case, whether the setting is changed via the GUI panel, or via script code, these are settings that affect the kOS mod in all saved games as soon as the change is made. It’s identical to editing the config file in the kOS installation directory, and in fact will actually change that file the next time the game saves its state.
Members (all Gettable and Settable)¶ Suffix Type Default Description IPU
scalar (integer) 150 Instructions per update UCP
boolean False Use compressed persistence STAT
boolean False Print statistics to screen RT2
boolean False Enable RemoteTech2 integration ARCH
boolean False Start on archive (instead of volume 1) OBEYHIDEUI
boolean True Obey the KSP Hide user interface key (usually mapped to F2). SAFE
boolean False Enable safe mode AUDIOERR
boolean False Enable sound effect on kOS error VERBOSE
boolean False Enable verbose exceptions TELNET
boolean False activate the telnet server TPORT
scalar (integer) 5410 set the port the telnet server will run on LOOPBACK
boolean True Force the telnet server to use loopback (127.0.0.1) address DEBUGEACHOPCODE
boolean false Unholy debug spam used by the kOS developers
-
Config:
IPU
¶ Access: Get/Set Type: scalar integer. range = [50,2000] Configures the
InstructionsPerUpdate
setting.This is the number of kRISC psuedo-machine-langauge instructions that each kOS CPU will attempt to execute from the main program per physics update tick.
This value is constrained to stay within the range [50..2000]. If you set it to a value outside that range, it will reset itself to remain in that range.
-
Config:
UCP
¶ Access: Get/Set Type: boolean Configures the
UseCompressedPersistence
setting.If true, then the contents of the kOS local volume ‘files’ stored inside the campaign save’s persistence file will be stored using a compression algorithm that has the advantage of making them take less space, but at the cost of making the data impossible to decipher with the naked human eye when looking at the persistence file.
-
Config:
STAT
¶ Access: Get/Set Type: boolean Configures the
ShowStatistics
setting.If true, then executing a program will log numbers to the screen showing execution speed statistics.
When this is set to true, it also makes the use of the ProfileResult() function available, for deep analysis of your program run, if you are so inclined.
-
Config:
RT2
¶ Access: Get/Set Type: boolean Configures the
EnableRT2Integration
setting.If true, then the kOS mod will attempt to interact with the Remote Tech 2 mod, letting RT2 make decisions about whether or not a vessel is within communications range rather than having kOS use its own more primitive algorithm for it.
Due to a long stall in the development of the RT2 mod, this setting should still be considered experimental at this point.
-
Config:
ARCH
¶ Access: Get/Set Type: boolean Configures the
StartOnArchive
setting.If true, then when a vessel is first loaded onto the launchpad or runway, the initial default volume will be set to volume 0, the archive, instead of volume 1, the local drive.
-
Config:
OBEYHIDEUI
¶ Access: Get/Set Type: boolean Configures the
ObeyHideUI
setting.If true, then the kOS terminals will all hide when you toggle the user interface widgets with Kerbal Space Program’s Hide UI key (it is set to F2 by default key bindings).
-
Config:
SAFE
¶ Access: Get/Set Type: boolean Configures the
EnableSafeMode
setting. If true, then it enables the following error messages:Tried to push NaN into the stack. Tried to push Infinity into the stack.
They will be triggered any time any mathematical operation would result in something that is not a real number, such as dividing by zero, or trying to take the square root of a negative number, or the arccos of a number larger than 1. Performing such an operation will immediately terminate the program with one of the error messages shown above.
If false, then these operations are permitted, but the result may lead to code that does not function correctly if you are not careful about how you use it. Using a value that is not a real number may result in freezing Kerbal Space Program itself if that value is used in a variable that is passed into Kerbal Space Program’s API routines. KSP’s own API interface does not seem to have any protective checks in place and will faithfully try to use whatever values its given.
-
Config:
AUDIOERR
¶ Access: Get/Set Type: boolean Configures the
AudibleExceptions
setting.If true, then it enables a mode in which errors coming from kOS will generte a sound effect of a short little warning bleep to remind you that an exception occurred. This can be useful when you are flying hands-off and need to realize your autopilot script just died so you can take over.
-
Config:
VERBOSE
¶ Access: Get/Set Type: boolean Configures the
VerboseExceptions
setting.If true, then it enables a mode in which errors coming from kOS are very long and verbose, trying to explain every detail of the problem.
-
Config:
TELNET
¶ Access: Get/Set Type: boolean Configures the
EnableTelnet
setting.When set to true, it activates a kOS telnet server in game that allows you to connect external terminal programs like Putty and Xterm to it. Turning the option off or on immediately toggles the server. (When you change it from false to true, it will start the server right then. When you change it from true to false, it will stop the server right then.) Therefore to restart the server after changing a setting like
TPORT
, DO this:// Restart telnet server: SET CONFIG:TELNET TO FALSE. WAIT 0.5. // important to give kOS a moment to notice and kill the old server. SET CONFIG:TELNET TO TRUE.
Of course, you can do the equivalent of that by using the GUI config panel and just clicking the button off then clicking it on.
-
Config:
TPORT
¶ Access: Get/Set Type: scalar (integer) Configures the
TelnetPort
setting.Changes the TCP/IP port number that the kOS telnet server in game will listen to.
To make the change take effect you may have to stop, then restart the telnet server, as described above.
-
Config:
LOOPBACK
¶ Access: Get/Set Type: boolean Configures the
TelnetLoopback
setting.If true, then it tells the kOS telnet server in game to refuse to use the computer’s actual IP address, and instead use the loopback address (127.0.0.1). This is the default mode the kOS mod ships in, in order to make it impossible get external access to your computer.
To make the change take effect you may have to stop, then restart the telnet server, as described above.
-
Config:
DEBUGEACHOPCODE
¶ Access: Get/Set Type: boolean Configures the
DebugEachOpcode
setting.NOTE: This makes the game VERY slow, use with caution.
If true, each opcode that is executed by the CPU will be accompanied by an entry in the KSP log. This is a debugging tool for those who are very familiar with the inner workings of kOS and should rarely be used outside the kOS dev team.
This change takes effect immediately.