Changes from version to version

This is a slightly more verbose version of the new features mentioned in the CHANGELOG, specifically for new features and for users familiar with older versions of the documentation who want only a quick update to the docs without reading the entire set of documentation again from scratch.

This list is NOT a comprehensive list of everything. Specifically, minor one-line changes, or bug fixes, are not mentioned here.

Most importantly, changes that might have broken previously working scripts are not always signposted here. To be sure, you should read the change log in the main github repository, which is repeated in the release announcements that are made in various places with each release.


Changes in 1.2

FLOOR and CEILING by decimal place

FLOOR(a,b) and CEILING(a,b) now allow you to chose the decimal place where the cutoff happens.

Added ROLL to HEADING()

HEADING(dir,pitch,roll) Now has a third parameter for roll. The new roll parameter is optional, so scripts using just the first two parameters should still work.

Wordwrap on Labels

You can set wordrap off for labels by the new suffx, Style:WORDWRAP.

Changes in 1.1.9.0

BOUNDING BOX

Added the new BOUNDS structure for bounding box information, and made an example using it on the tutorials page.

TERNARY OPERATOR “CHOOSE”

A new expression ternary operator exists in kerboscript, called CHOOSE. (Similar to C’s ”?” operator, but with different syntax.)

New suffixes for Vecdraw

New suffixes giving you more control over the appearance of vecdraws: Vecdraw:POINTY Vecdraw:WIPING

Terminal default size

Two new config settings for a default terminal size for new terminals:

Config:DEFAULTWIDTH, Config:DEFAULTHEIGHT

Additional Atmospheric information

Added some more information to the atmosphere structure, (mostly for people trying to perform drag calculations: MOLARMASS, ADIABATICINDEX, ALTITUDETEMPERATURE).

Also added the ability to read some more of the values the game uses for mathematical constants, to work with this information: Avogadro, Boltzmann, and IdealGas.

UNSET documentation

Explicitly mention the unset command, which has existed for a long time but apparently wasn’t in the documentation.

LIST command

Removed obsolete documentation about a no-longer-existing “FROM” variant of the LIST command that went like this: LIST things FROM vessel IN variable.

DROPPRIORITY()

Described the new DROPPRIORITY() built-in function that you can use when you want to write a long-lasting trigger body without it preventing other triggers from interrupting like it normally would.

Changes in 1.1.8.0

Nothing but minor documentation error corrections - no new features documented.

Changes in 1.1.7.0

IR Next

Documented the change to using IR Next instead of IR.

CORE:TAG

Documented CORE:TAG.

PAUSE

Added ability to pause the game with Kuniverse:PAUSE().

List Fonts

Added FONTS to the things you can LIST.

Changes in 1.1.6.2

Nothing of significance changed in the docs. This was a fix to switch files from PNG format to DDS format for GUI icons kOS uses.

Changes in 1.1.6.1

The various thrust and ISP calculations that take pressure as a parameter prevent you from using negative values for pressure. Now they are clamped to be no lower than zero. This change documents this fact.

Changes in 1.1.6.0

GUI tooltips

Described how to make GUI tooltips work. See:

5% null zone

Mentioned the stock null zone issue with RCS translation.

Part:CID

Added new suffix, Part:CID

An External Tutorial

Added an external tutorial link to the Tutorials page.

G and G0 constants

Added constant:G and constant:G0.

Removed old notices

Some “this changed in version ....” notices had aged beyond their usefulness and were removed.

Document Simulate in BG

Documented the need to have Simulate in BG enabled when playing in windwed mode, on the Telnet page.

Stage/decouple docs

Many edits to the pages about stages and decouplers to clarify points.

Vecdraw delegate

Documented that the Vecdraw constructor can now take delegates.

New suffixes on Body page

Body page now has more fleshed-out examples and documentation to go with the new :HASOCEAN, :HASSURFACE, and :CHILDREN suffixes

New Basic tutoial

New Basic Tutorial page.

Clarified CPU hardware page

Much of the CPU hardware page has been re-done to reflect some of the refactors that have happened in this revision.

Changes in 1.1.5.2

This was a compatibility release for KSP 1.4.1

Changes in 1.1.5.0

This was a compatibility release for KSP 1.3.1

Changes in 1.1.4.0

There were numerous optimizations applied to the source code that most end users will not see directly. Users should however see a performance boost. Notable modifications were to the regular expressions engine used to parse script files, optimization of internal string operations, better caching of suffix information, and migrating to a dual stack cpu instead of a single stack with hidden offsets.

File scope was also modified so that each file properly defines a scope. This means that local variables declared in script files called from other scripts are no longer treated as part of the global scope. It also means that script parameters are local to the file itself and will not overwrite global variables.

Work also began to include identifier information within opcodes themselves rather than as a pushed string literal to be evaluated separately. This should help with execution time and reduce the number of opcode calls within the kOS virtual machine.

Changes in 1.1.3.0

Made documentation of how SAS fights with lock steering more prominent and mentioned in more places.

Documentation for Skin:ADD fixed to mention the second parameter.

Documentation no longer implies TERMVELOCITY is a suffix (it was obsoleted, but the documentation wasn’t removed).

Changes in 1.1.2

None: This was a dummy version increase needed to “kick” CKAN and alert it to a version number change that we messed up on in the previous release.

Changes in 1.1.1

None: This was a pure compatibility with KSP 1.3 update, nothing more.

Changes in 1.1.0

GUI

The GUI system was added new with version 1.1.0.

Terminal Font

Now that the terminal can display any font from your OS, you can now display any Unicode character you like.

Regex Part Searches

You may now use Vessel:PARTSTAGGEDPATTERN to perform regular expression searches for part tags.

Triggers take locals

The previous restriction that triggers such as WHEN and ON must only use global variables in their check expressions has been removed. Now they can use local variables and will remember their closures.

LATLNG of other body

New suffix Body:GEOPOSITIONLATLNG lets you get a LATLNG from a body other than the current body you are orbiting.

Changes in 1.0.3

No significant changes, compiled for KSP v1.2.2.

Changes in 1.0.2

Sound/Kerbal Interface Device (SKID)

The SKID chip allows scripts to output procedural sound clips. Great for custom error tones, or for playing simple music. A basic example would be:

SET V0 TO GETVOICE(0).      // Gets a reference to the zero-th voice in the chip.
V0:PLAY( NOTE(400, 2.5) ).  // Starts a note at 400 Hz for 2.5 seconds.
                            // The note will play while the program continues.
PRINT "The note is still playing".
PRINT "when this prints out.".

For an example of a song, check out the Example song section of voice documentation

Also check out the SKID chip documentation for an indepth explaination.

CommNet Support

kOS now supports communications networks through KSP’s stock CommNet system as well as RemoteTech (only one networking system may be enabled at a time). The underlying system was modified and abstracted to allow both systems to use a common interface. Other mods that would like to add network support can implement this system as well without a need to update kOS itself.

Check out the Connectivity Managers documentation here

Trajectories Support

If you have the Trajectories mod for KSP installed, you can now access data from that structure using ADDONS:TR. This provides access to impact prediction through the Trajectories mod. For example:

if ADDONS:TR:AVAILABLE {
    if ADDONS:TR:HASIMPACT {
        PRINT ADDONS:TR:IMPACTPOS.
    } else {
        PRINT "Impact position is not available".
    }
} else {
    PRINT "Trajectories is not available.".
}

For more information see the Trajectories Addon Documentation

Changes in 1.0.1

Terminal Input

A new structure TerminalInput is available as a suffix of Terminal, allowing scripts to respond to user input.

Example:

terminal:input:clear().
print "Press any key to continue...".
terminal:input:getchar(). // blocking callback
print "Input will be echoed back to you.  Press q to quit".
set done to false.
until done {
    if (terminal:input:haschar) {
        set input to terminal:input:getchar().
        if input = "q" {
            set done to true.
        }
        else {
            print "Input read was: " + input + " (ascii " + unchar(input) + ")".
        }
    }
    wait 0.
}

Timewarp

The new TimeWarp structure provides better access to information about timewarp. It provides lists of warp rates, information about the physics timestep, and can tell you if the warp rate has settled.

Example:

print kuniverse:timewarp:ratelist. // prints the rates available in the current mode
set eta to 150 * 6 * 60 * 60. // 150 days
kuniverse:timewarp:warpto(time:seconds + eta).
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
wait 0.
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
wait 0.
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
wait 0.
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
wait 0.
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
wait 60 * 60.
kuniverse:timewarp:cancelwarp().
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
print "rate:    " + kuniverse:timewarp:rate.
wait until kuniverse:timewarp:issettled.
print "delta t: " + kuniverse:timewarp:physicsdeltat.  // see the step change
print "rate:    " + kuniverse:timewarp:rate.

Changes in 1.0.0

Subdirectories

See Understanding directories.

You are now able to store subdirectories (“folders”) in your volumes, both in the archive and in local volumes. To accomodate the new feature new versions of the file manipulation commands had to be made (please go over the documentation in the link given above).

Boot Subdirectory

See Special Handing of files in the “boot” directory.

To go with Subdirectories, now you make a subdirectory in your archive called boot/, and put all the candidate boot files there.

PATH structure

You can now get information about a file’s path and location.

New RUNPATH command

New RUNPATH command lest you make the program to run be a varying expression.

Communications

Communication between scripts on different CPUs of the same vessel or between different vessels.

Message Structure

A Message structure added to be used with the new communications system.

Allow scripted vessel launches

GETCRAFT(), LAUNCHCRAFT(), CRAFTLIST(), LAUNCHCRAFTFROM() were added as new suffixes to the Kuniverse structure.

ETA to SOI change

ORBIT:NEXTPATCHETA to get the time to the next orbit patch
transition (SOI change).

VESSEL:CONTROLPART

VESSEL:CONTROLPART to get the part which has been used as the current “control from here”.

Maneuver nodes as a list

ALLNODES bound variable added.

More pseudo-action-groups

Some new Pseudo-Action-Groups added for handling a lot of new groups of parts.

Get Navball Mode

NAVMODE bound variable:

UniqueSet

Added a UniqueSet collection for holding a generic set of things where order is irrelevant and duplicates are guaranteed not to exist.

Changes in 0.20.1

This release is just a bug fix release for the most part, with only just one new feature:

3-axis Gimbal Disabling

You can now selectively choose which of the 3-axes of an engine gimbal you want to lock, rather than having to lock the entire gimbal or none of it.

(See suffixes “PITCH”, “YAW”, and “ROLL” of the gimbal documentation.)

Changes in 0.20.0

This release is functionally identical to v0.19.3, it is recompiled against the KSP 1.1 release binaries (build 1230)

Changes in 0.19.3

Interuptable Triggers

Triggers are no longer required to complete within a single update frame, allowing them to be more than the IPU instructions long. This also means that they are no longer guaranteed to be atomic, and that long running triggers may prevent the execution of other triggers or the mainline code. See the trigger documentation for details.

Script Profiling

You may now profile the performance of your scripts to better understand how the underlying opcodes operate, as well as to identify slow executing sections of code. See the function ProfileResult for more information.

Compiled LOCK

In previous versions, attempting to create a lock with a duplicate identifier from within a compiled script would throw an error regarding label replacement. In this version, the handling of lock objects is updated to be more flexible at run-time, instead of relying on compile-time information.

ON Using Expressions

In previous versions, ON would not accept an expression as a parameter like this:

ON STAGE:READY {
    PRINT "STAGE: " + STAGE:READY.
}
ON ROUND(MAX(2000, ALT:RADAR)) {
    PRINT ROUND(ALT:RADAR).
}

ON will now evaluate the expression instead of treating it like a variable identifer.

Changes in 0.19.2

This was mostly a bug fix release. Not much changed in the documentation.

FORCEACTIVE

New alias KUNIVERSE:FORCEACTIVE() can be used instead of the longer name KUNIVERSE:FORCESETACTIVEVESSEL().

Changes in 0.19.1

This change was mostly for small bug fixes and didn’t affect the documentation much.

Mentioned PIDLoop() function in tutorial

Added section to PID loop tutorial that explains better that there’s a new function for doing PID loops. The tutorial had been originally written before that function existed.

New Terminal brightness and char size features

Terminal structure now has suffixes, TERMINAL:BRIGHTNESS, TERMINAL:CHARWIDTH, and TERMINAL:CHARHEIGHT to go with the new widgets on the terminal GUI.

Changes in 0.19.0

Art asset changes

Though not represented in these documents, numerous changes to the part models and artwork are included as part of this update, including the new KAL9000 high-end computer part.

Varying Power Consumption

Electrical drain is now handled in a dynamically changing way that actually notices how much you are using the CPU and uses less power if the CPU is mostly idling (if it spends most of its time on WAIT statements).

For mods that want to re-balance the meaning of electric charge units, the drain factor is also editable in module config fields in the various part.cfg files the mod ships with. This opens them up to being changed by ModuleManager rules.

Delegates (function pointers)

User functions and built-in functions (but not suffixes yet) can now be referred to with function pointers called delegates along with “currying” of pre-loaded arguments.

Optional Defaulted Parameters

User functions and user programs can now be configured to have optional trailing parameters that receive unmentioned when calling them.

File I/O

VolumeFile now lets you read and write arbitrary strings in files in a more natural way than using the LOG command, and allows you to read the whole file into one big string in one go.

Serialization in JSON

Automatic serialization system added to the file operations to save/load some kinds of data values to JSON-format files.

Universal Object Suffixes

All user values now are a kind of structure and thus there are a few universal suffixes that can be used to query what type of data a thing is (:ISTYPE and :TYPENAME).

Multimode Engine and Gimbal Support

Engines can now support multiple-mode information, and can acces thei gimbal information in the :GIMBAL suffix.

Range

New Range type for getting arbitrary iterable collections of ranges of integers.

Char and Unchar

CHAR(a) and UNCHAR(a) functions for getting the Unicode value of a character or making a character from its Unicode value.

For loop on string chars

The for loop can now iterate over the characters of a string.

JOIN

Join suffix on lists now lets you make a string with a delimeter of the list’s elements.

Hours per day

KUniverse now has a suffix to let you read the user setting for whether the clock is using a 24 hour day or a Kerbin 6 hour day.

Archive

The reserved word Archive is now a first class citizen so that SET FOO TO ARCHIVE. works like you’d expect it to.

Changes in 0.18.2

Queue and Stack

Queues and Stacks are now a feature you can use along with lists.

Volumes and Processors integration

Volumes now get a default name equal to the core processor’s nametag, and have several suffixes that can be queried.

Get the volume that goes with a core

Debuglog

Debuglog suffix of KUNIVERSE for writing messages to the Unity log file.

Changes in 0.18.1

(This update had only bug fixes and nothing that affected these user documentation pages.)

Changes in 0.18 - Steering Much Betterer

Steering Overhaul

A major change to Cooked Steering!

Should help people using torque-less craft like with Realism Overhaul. Removed the old steering logic and replaced it with a nice auto-tuning system.

SteeringManager structure now lests you acccess and alter parts of the cooked steering system.

PIDLoop structure now lets you borrow the PID mechanism used by the new cooked steering, for your own purposes.

Lexicon

New Lexicon structure now allows associative arrays.

String methods

New String structure now allows string manipulations.

Science Experiment Control

New ScienceExperimentModule allows you to fire off science experiments bypassing the user interface dialog.

Crew Member API

New CrewMember structure allows you to query the registered crew - their class, gender, and skill.

LOADISTANCE

New LOADDISTANCE obsoletes the previous way it worked.

Renamed built-ins

“AQUIRE” on docking ports is now “ACQUIRE”. “SURFACESPEED” is now “GROUNDSPEED” instead.

Enforces control of own-vessel only

It was previously possible to control vessels that weren’t attached to the kOS computer running the script. This has been corrected.

Dynamic pressure

DYNAMICPRESSURE, or Q, a new suffix of Vessel.

DEFINED keyword

DEFINED keyword that can be used to check if a variable has been declared.

KUNIVERSE

KUniverse structure letting you break the 4th wall and revert from a script

SolarPrimeVector

SolarPrimeVector, a bound variable to provide universal longitude direction.


Changes in 0.17.3

New Looping control flow, the FROM loop

There is now a new kind of loop, the FROM loop, which is a bit like the typical 3-part for-loop seen in a lot of other languages with a separate init, check, and increment section.

Short-Circuit Booleans

Previously, kerboscript’s AND and OR operators were not short-circuiting. Now they are.

New Infernal Robotics interface

There are a few new helper addon utilities for the Infernal Robotics mod, on the IR addon page.

New RemoteTech interface

There are a few new helper addon utilities for the RemoteTech mod, on the RemoteTech addon page.

Deprecated INCOMMRANGE

Reading from the INCOMMRANGE bound variable will now throw a deprecation exception with instructions to use the new RTAddon structure for the RT mod.

Updated thrust calculations for 1.0.x

KSP 1.0 caused the thrust calculations to become a LOT more complex than they used to be and kOS hadn’t caught up yet. For a lot of scripts, trying to figure out a good throttle setting is no longer a matter of just taking a fraction of the engine’s MAXTHRUST.

We fixed the existing suffixes of MAXTHRUST and AVAILABLETHRUST for engine and vessel to account for the new changes in thrust based on ISP at different altitudes. MAXTHRUST is now the max the engine can put out at the CURRENT atmospheric pressure and current velocity. It might not be the maximum it could put out under other conditions. The AVAILABLETHRUST suffix is now implemented for engines (it was previously only available on vessels). There are also new suffixes MAXTHRUSTAT (engines and vessels), AVAILABLETHRUSTAT (engines and vessels), and ISPAT (engines only) to read the applicable value at a given atmospheric pressure.

New CORE struct

The core bound variable gives you a structure you can use to access properties of the current in-game CPU the script is running on, including the vessel part it’s inside of, and the vessel it’s inside of, as well as the currently selected volume. Moving forward this will be the struct where we enable features that interact with the processor itself, like local configuration or current operational status.

Updated boot file name handling

Boot files are now copied to the local hard disk using their original file name. This allows for uniform file name access either on the archive or local drive and fixes boot files not working when kOS is configured to start on the Archive. You can also get or set the boot file using the BOOTFILENAME suffix of the CORE bound variable.

Docking port, element, and vessel references

You can now get a list of docking ports on any element or vessel using the DOCKINGPORTS suffix. Vessels also expose a list of their elements (the ELEMENTS suffix) and an element will refernce it’s parent vessel (the VESSEL suffix).

New sounds and terminal features

For purely cosmetic purpopses, there are new sound features and
a few terminal tweaks.
  • A terminal keyclick option for the in-game GUI terminal.
  • The ability to BEEP when printing ascii code 7 (BEL), although the only way currently to achieve this is with the KSlib’s spec_char.ksm file, as kOS has no BEL char, but this will be addressed later.
  • A sound effect on exceptions, which can be turned off on the CONFIG panel.

Clear vecdraws all at once

For convenience, you can clear all vecdraws off the screen at once now with the clearvecdraws() function.


Changes in 0.17.0

Variables can now be local

Previously, the kOS runtime had a serious limitation in which it could only support one flat namespace of global-only variables. Considerable archetecture re-work has been done to now support block-scoping in the underlying runtime, which can be controlled through the use of local declarations in your kerboscript files.

Kerboscript has User Functions

The primary reason for the local scope variables rework was in support of the new user functions feature which has been a long-wished-for feature for kOS to support.

Community Examples Library

There is now a new fledgling repository of examples and library scripts that we hope to be something the user community contributes to. Some of the examples shown in the kOS 0.17.0 release video are located there. The addition of the ability to make user functions now makes the creation of such a library a viable option.

Physics Ticks not Update Ticks

The updates have been moved to the physics update portion of Unity, instead of the animation frame rate updates. This may affect your preferred CONFIG:IPU setting. The new move creates a much more uniform performance across all users, without penalizing the users of faster computers anymore. (Previously, if your computer was faster, you’d be charged more electricity as the updates came more often).

Ability to use SAS modes from KSP 0.90

Added a new third way to control the ship, by leaving SAS on, and just telling KSP which mode (prograde, retrograde, normal, etc) to put the SAS into.

Blizzy ToolBar Support

If you have the Blizzy Toolbar mod installed, you should be able to put the kOS control panel window under its control.

Ability to define colors using HSV

When a color is called for, such as with VECDRAW or HIGHLIGHT, you can now use the HSV color system (hue, saturation, value) instead of RGB, if you prefer.

Ability to highlight a part in color

Any time your script needs to communicate something to the user about which part or parts it’s dealing with, it can use KSP’s part highlighting feature to show a part.

Disks can be made bigger with tweakable slider

All parts that have disk space now have a slider you can use in the VAB or SPH editors to tweak the disk space to choose whether you want it to have 1x, 2x, or 4x as much as its default size. Increasing the size increases its price and its weight cost.

You Can Transfer Resources

You can now use kOS scripts to transfer resources between parts for things like fuel, in the same way that a manual user can do by using the right-click menus.

Kerbal Alarm Clock support

If you have the Kerbal Alarm Clock Mod isntalled, you can now query and manipulate its alarms from within your kOS scripts.

Query the docked elements of a vessel

You can get the docked components of a joined-together vessel as separate collections of parts now.

Support for Action Groups Extended

While there was some support for the Action Groups Extended mod before, it has been greatly improved.

LIST constructor can now initialize lists

You can now do this:

set mylist to list(2,6,1,6,21).

to initialize a list of values from the start, so you no longer have to have a long list of list:ADD commands to populate it.

ISDEAD suffix for Vessel

Vessels now have an :ISDEAD suffix you can use to detect if the vessel has gone away since the last time you got the handle to it. (for example, you LIST TARGETS IN FOO, then the ship foo[3] blows up, then foo[3]:ISDEAD should become true to clue you in to this fact.)