kOS is a scriptable autopilot Mod for Kerbal Space Program. It allows you write small programs that automate specific tasks.
Documentation : http://ksp-kos.github.io/KOS_DOC/
Addon release thread: http://forum.kerbalspaceprogram.com/index.php?/topic/61827-/
Addon development thread: http://forum.kerbalspaceprogram.com/index.php?/topic/61834-/
Released on 2019-08-07
This update is a mix of new features, mostly
mylex["key1"]you can now say
mylex:key1, provided the key is something that works as a valid identifier string (no spaces, etc). pull request.
CHOOSE expr1 IF bool_expr ELSE expr2. If bool_expr is true, it returns expr1. If it's false, it returns expr2. pull request.
Released on 2019-05-01
Mostly this was motivated by a need to get an officially recompiled-for-KSP-1.7 version out there (even though the previous version worked on KSP 1.7, it wasn't officially compiled for KSP 1.7.)
Along the way there were one or two bug fixes and documenation cleanups.
LIST ENGINESin regards to multi-mode engines was restored to what it was supposed to have been. Becuase of a small change KSP made, it's been wrong since KSP 1.5, apparently. Prior to KSP 1.5 it worked correctly by giving a list that contains one entry in the LIST ENGINES per engine. But since then it has been returning 3 duplicate instances in the list per each multi-mode engine. This release fixes it, and the previous correct behavior is restored (just returning one, not three). The problem was discovered during regression testing of the pull request, so the fix is inside that same pull request.
SET TARGETto a Celestial Body and could only set targets to vessels or parts. This bug was introduced in the previous release of kOS by a hamfisted typing error while fixing the fact that Body wasn't serializable. It was an error that unfortunately didn't result in any noticable problem when compiling or testing, as it only removed the Body's declaration that "I am the kind of class that knows how to be a target" and it affected nothing else. pull request
panelsvalue on or off would result in infinite log spam if the ship contained a fixed undeployable solar panel like the OX-STAT. kOS was watching for the existence of ModuleDeployableSolarPanel to see if the part could be deployed or not, but apparently at some point KSP started defining all solar panels as having ModuleDeployableSolarPanel, even if they're not actually deployable. Now kOS doesn't treat the panel as deployable unless it also has its animation property defined in addition to claiming to be a ModuleDeployableSolarPanel. pull request
Released on 2019-04-09
Mostly fixes. The motivation for this release is to get fixes out to the public before KSP 1.7 comes.
Built for KSP 1.6.1
CORE:TAGis now settable pull request
KUNIVERSE:PAUSEsuffix added. pull request
TIME(seconds)Constructor to make a
Timespanout of a Universal timestamp. pull request
LIST FONTS.feature so the user can see which font names are loaded into Unity for use in user GUIs. pull request
Released on 2019-02-18
Built for KSP 1.6.1
This is a patch for protecting against some kinds of file folder access that concerned us for those people using kOS to set up "Twitch Plays kOS" streams.
Although we try to block a kerboscript's ability to access files outside the
Ships/Script/ folder, we cannot (and will not) guarantee to have thought of every trick a clever person might come up with to fool the system into allowing access. As always, be wary that if you allow any random arbitrary person to run scripts (in any system, in any language, really) on your own computer that you have not read through and vetted yourself, that you are doing this at your own risk.
If you currently have a "Twitch Plays kOS" stream, or plan to set up one in the future, PLEASE see this writeup:
Released on 2019-02-09
Built for KSP 1.6.1
Nothing but a quick patch to v18.104.22.168.
The v22.214.171.124 update resized a few of the PNG images used in the GUI panels, which exposed a bug that only manifests on some graphics cards. KSP converts PNGs to DDS format upon loading them, and appears to use the Direct3D graphics driver to do so. Older graphics cards refuse to do that conversion on images that aren't exactly expected sizes. We were just "lucky" that this never happened in the past with the image sizes we were using. Converting them to DDS ourselves and shipping them that way, we bypass this problem because the user's own graphics drivers aren't responsible for doing the conversion.
Released on 2019-02-04
Nothing but a quick patch to v126.96.36.199.
v188.8.131.52 had a flaw in MAXTHRUST, AVAILABLETHRUST, and engine ISP calculations that always calculated them as if your ship was in vacuum even when it's not. This was deemed an important enough problem to warrant a quick-fix release.
Released on 2019-02-04
Built for KSP 1.6.1
It's been a long time without a release. We kept putting it off until "that one more thing" was merged in, and there was always "that one more thing", again and again, that kept putting off the release more and more. Eventually we decided to release what we had since there's so many fixes the public weren't getting.
This release incorporates 50 separate Pull Requests from many individuals. As always, thanks to everyone who contributed over the last year. (Has it really been that long? Almost.)
(None that we know of, but this is a big update so we could have missed something.)
Released on 2018-03-14
This release is mostly just a recompile to make kOS work with KSP 1.4.1, with the few changes that were needed to keep it working, and whatever bug fixes happened to already be implemented when when KSP 1.4.1 came out.
Released on 2018-01-25
This is NOT a release for the most recent KSP. It is a back-port for KSP 1.2.2 so people using Realism Overhaul can use it.
Note, Please take this into account if you are using RP-0 with Realism Overhaul: RP-0 by default does not "cost" the kOS parts properly, so if you have all non-costed parts banned, kOS parts are banned too. This leaves you with only the default disk capacity of 5000 in all avionics parts in RO, which is incorrect. To fix this problem and get reasonable disk capacity, change this line in:
name = kOSProcessor
diskSpace = 40000 // Edited by dunbaratu - was 5000 in defalt RO config which is wrong.
Released on 2018-01-01
Built for KSP v1.3.1
This release is just to fix one bug introduced by v184.108.40.206 that was discovered post-release by the users, during the Christmas-NewYears time. The fix was quick but release was delayed for after the holidays.
None that we know of. This change shouldn't even require recompiling KSM files, presuming you had them recompiled already for v220.127.116.11.
declare functionwhen you say neither
global, was always defaulting to
globalin the previous release (kOS 18.104.22.168), when it was supposed to be context dependent. It was meant to be
globalonly when the function is at outermost file scope, but
localwhen the function is nested at any inner scope deeper than that. This is now fixed, and this bug is the main reason for this hotfix release. pull request
Released on 2017-12-27
This release was primarily focused on speedups and smoothness of execution. We welcomed a new developer (github username @tsholmes) who contributed a lot of bottleneck analysis and code speedups. The goal was to reduce the burden kOS causes to the physics rate of the game, and consequently also allow tech tree scaled performance by era for the kOS computer parts themselves (slow at first, faster later).
localat the outermost scope of a program file (outside any curly braces), then it had the same effect as
global, creating a variable that you could see from anywhere outside that program file.
localactually means something in that scope. To get the old behavior you would need to explicitly call the variable
global. (The variables magically created via the lazyglobal system will still be global just like they were before.)
localin a file had the same effect as declaring a
globalthere). Now each program file has its own scope (and also the parameters passed to a program file are local to that file scope).
localkeyword in the function declaration to make that happen. pull request
,character to be used as a decimal symbol will no longer be blocked. kOS now forces the use of
CultureInvariantwhen parsing numbers, so all locales will be required to use the
.character for decimals. pull request
part:hasmodulesuffix. pull request
Released on 2017-10-16
Released on 2017-09-19
Released on 2017-09-19
For this release we instituted a rule partway through that only bug fixes should be allowed (some of the first few changes were enhancements rather than bug fixes, but after that, its all bug fixes). This was in a vain hope that doing so would get a release out faster than normal.
(Can't think of any.)
Released on 2017-06-21
CKAN info inside the ZIP was wrong for v1.1.1 (it had a max version number smaller than current version number, so CKAN refused to pick it up). This corrects that problem.
Released on 2017-06-20
Now ready for official full release for KSP 1.3.
Released on 2017-06-13
RUNcommand.) pull request
Released on 2016-12-08
This release is nearly identical to v1.0.2, except that it was compiled against binaries from KSP v1.2.2 (released just before we published) and the version numbers have been advanced. While it appears that kOS v1.0.2 is compatible with KSP v1.2.2, we wanted to err on the side of caution and provide an explicitly compatible release. Please review the changelog for v1.0.2 if you are upgrading from an earlier version.
Released on 2016-12-07
stagebound variable are no longer rounded to 2 decimal places. Previously they were rounded to assist in detecting "zero" fuel, but they cause inequality issues when comparing to the newer
stagebound variable has changed with regard to asparagus staging. If you have smaller tanks that can be staged,
0even if you still have an engine firing. This is a break from previous versions of kOS, but is aligned with the current UI design. Previous versions also aligned with the KSP UI, but the UI mechanic was updated with KSP 1.2.x
ADDONS:TRpull request | documentation
ALTITUDEVELOCITYsuffixes to `geocoordinates pull request | documentation
stringvalues for parsing numerical values pull request | documentation
ROLLCONTROLANGLERANGEto dictate the maximum value of
ANGLEERRORfor which the manager will attempt to control roll commit | documentation
etabound variable) pull request
unlock allinside a trigger will try to unlock functions too pull request
Released on 2016-10-11
We wanted to get the last bug fixes and new features into the hands of any users who might not update KSP to 1.2 right away. Traditionally there are some mods that take a while to update when KSP releases a new version, and many users choose to wait for all of their favorite mods to update before upgrading KSP. By releasing in conjunction with the update, we can ensure that as many users as possible have access to these latest updates. We will be releasing a version of kOS that is compatible with KSP 1.2 as soon as possible after the final build is released to the public.
stagecommand/function now implements the yield behavior, waiting until the next physics tick to return. This ensures that all vessel stats are updated together. (https://github.com/KSP-KOS/KOS/pull/1807)
timewarpstructure, available on the
kuniversebound variable. This structure provides additional information and control over time warp. The old warp bound variables remain in place. (https://github.com/KSP-KOS/KOS/issues/1790 and https://github.com/KSP-KOS/KOS/pull/1820)
terminalinputstructure for keyboard interaction from within scripts! Currently support is only provided for getting single characters. (https://github.com/KSP-KOS/KOS/pull/1830)
Please check http://ksp-kos.github.io/KOS_DOC/changes.html for more detailed explanations for the new features.
time:clockto pad zeros (https://github.com/KSP-KOS/KOS/issues/1771 and https://github.com/KSP-KOS/KOS/pull/1772)
vessel("foo")if "foo" is the name of the current vessel (https://github.com/KSP-KOS/KOS/issues/1565 and https://github.com/KSP-KOS/KOS/pull/1802)
lock steeringno longer throws an exception inside of an anonymous functions (https://github.com/KSP-KOS/KOS/issues/1784 and https://github.com/KSP-KOS/KOS/pull/1811)
waitafter the cpu boots (https://github.com/KSP-KOS/KOS/issues/1785)
Released on 2016-08-15
Hey let's stop calling it Beta
@Dunbaratu Dunbaratu released this 3 hours ago About the name:
kOS has been around long enough that we figured it was long overdue for us to stop calling it 0.something. Lots of people are using it, and we're worried about backward compatibility enough that we're not really treating it like a Beta anymore. This version contains mostly a few things that we knew might break backward compatibility so we'd been putting them off for a long time. A jump to 1.0 seems a good time to add those changes.
Of course, it has lots of other changes for whatever else was being worked on since the last release. BREAKING CHANGES
As always, if you use the compiler feature to make KSM files, you should recompile the KSM files when using a new release of kOS or results will be unpredictable. New Subdirectories ability has deprecated several filename commands such as delete, copy, and rename. They will still work, but will complain with a message every time you use them, as we may be removing them eventually. The new commands deletepath, copypath, and movepath described below are meant to replace them. When using a RemoteTech antenna that requires directional aiming, in the past you could aim it at mission control with SETFIELD("target", "mission-control") and now you have to say SETFIELD("target", "Mission Control") instead, due to changes in RT's naming schemes. Previously the Y and Z axes of SUN:VELOCITY:ORBIT were swapped. (#1764) This has been fixed so it is now the same as for any other body, however scripts might exist that had previously been swapping them back to compensate for this, and if there were they would now break since that swapping is no longer needed.
Subdirectories: (http://ksp-kos.github.io/KOS_DOC/commands/files.html) 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). In the Archive, which is really your Ships/Script/ directory on your computer, these subdirectories are stored as actual directories in your computer filesystem. (For example, the file 0:/dir1/dir2/file.ks would be stored at Kerbal Space Program/Shipts/Script/dir1/dir2.file.ks on your real computer.) In local volumes, they are stored in the persistence.sfs savegame file like usual. (Pull Request discussion record: #1567) Boot subdirectory: (http://ksp-kos.github.io/KOS_DOC/general/volumes.html#special-handling-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. When selecting a boot file in the VAB or SPH, the selections are taken from there and need not contain the "boot_" prefix to the filename anymore. Old boot files will be grandfathered in that are named the old way, however. CORE:BOOTFILENAME is now a full path. i.e. boot/myfile.ks. PATH structure now allows you to get information about the new full subdirectories system from your scripts. (http://ksp-kos.github.io/KOS_DOC/structures/volumes_and_files/path.html) New RUNPATH command now allows any arbitrary string expression to be used as the name of the file to be run. i.e. set basename to "prog". set num to 1. runpath(basename+num, arg1). // same as run prog1(arg1). As part of the support for this, programs with a large number of RUN commands (or RUNPATH commands) should now take up a bit less of a memory footprint than they used to in their compiled form (and thus in KSM files too). (http://ksp-kos.github.io/KOS_DOC/commands/files.html#runpath-and-runoncepath) Communication between scripts on different CPUs of the same vessel or between different vessels. (http://ksp-kos.github.io/KOS_DOC/commands/communication.html) A new structure, the Message, contains some arbitrary piece of data you choose (a number, a string, a list collection, etc), and some header information kOS will add to it that describes where it came from, when it was sent, and so on. What you choose to do with these arbitrary chunks of data is up to you. kOS only lets you send them. You design your own protocol for what the data means. If RemoteTech is installed, a connection is needed to send a message to another vessel (but not to a CPU on the same vessel). And, the message won't actually show up in the other vessel's queue until the required lightspeed delay. To handle KSP's inability to have different vessels far away from each other both fully loaded and active, you do have to switch scenes back and forth between distant vessels if you want them to have a conversation back and forth. Messages that were meant to arrive on a vessel while it wasn't within active loading range will wait in the recever's vessel queue until you switch to it, so you don't have to hurry and switch "in time" to get the message. Added anonymous functions : (http://ksp-kos.github.io/KOS_DOC/language/anonymous.html) By placing arbitrary braces containing the body of a function anywhere within the script that an expression is expected, the compiler builds the function code right there and then returns a delegate of it as the value of the expression. New 3rd-party addon framework (https://github.com/KSP-KOS/KOS/tree/develop/src/kOS/AddOns/Addon%20Readme.md) allows authors of other KSP mods to add hooks into kOS so that kOS scripts can interface with their mods more directly, without kOS developers having to maintain that code themselves in the kOS repository. (Pull Request discussion record: #1667) allow scripted vessel launches KUNIVERSE:GETCRAFT(), KUNIVERSE:LAUNCHCRAFT(), KUNIVERSE:CRAFTLIST(), and KUNIVERSE:LAUNCHCRAFTFROM() allow you to script the changing of scenes and loading of vessels into those scenes. While this breaks the 4th wall quite a bit (how would an autopilot choose to manufacture an instance of the plane?), it's meant to help with script testing and scripts that try to repeatedly run the same mission unattended. (http://ksp-kos.github.io/KOS_DOC/structures/misc/kuniverse.html) eta to SOI change: Added SHIP:OBT:NEXTPATCHETA to get the time to the next orbit patch transition (SOI change). (http://ksp-kos.github.io/KOS_DOC/structures/orbits/orbit.html#attribute:ORBIT:NEXTPATCHETA) get control-from: Added SHIP:CONTROLPART to return the Part of the vessel that is currently set as its "control from here" part. (http://ksp-kos.github.io/KOS_DOC/structures/vessels/vessel.html#attribute:VESSEL:CONTROLPART) maneuver nodes as a list:( New ALLNODES bound variable that returns a list of all the currently planned manuever nodes (the nodes you could iterate through with NEXTNODE, but rendered into one list structure). (http://ksp-kos.github.io/KOS_DOC/bindings#allnodes) Several new pseudo-action-groups (akin to "panels on", that aren't action groups as far as stock KSP is concerned, but kOS treats them like action groups) were added. (http://ksp-kos.github.io/KOS_DOC/commands/flight/systems#kos-pseudo-action-groups) Ability to get/set the navball mode (surface, orbital, target) with the NAVMODE bound variable: i.e. SET NAVMODE TO "SURFACE".. UniqueSet structure. (http://ksp-kos.github.io/KOS_DOC/structures/collections/uniqueset.html) A collection intended for when all you care about is whether a equivalent object exists or doesn't exist yet in the collection, and everything else (order, etc) doesn't matter.
In some cases (#1661) the program wouldn't stop immediately when you execute a kuniverse command that reloads a save or switches scenes. It would instead finish out the remainder of the IPU instructions in the current physics tick. After the fix, causing a scene change (or reload) automatically stops the program right there since anything it does after that would be moot as the game is about to remove everything it's talking about from memory. If using "Start on archive", with Remote Tech, a misleading "power starved" error was thrown when you reboot a probe that's out of antenna range. (#1363) unchar("a") was apparently broken for a few months and we hadn't noticed. The root cause was that its implementation had to be edited to comply with the change that enforced the VM to only use kOS Structure types on the stack. The need for that change had been missed. (#1692) Previously Infernal Robotics allowed you to move servos that weren't even on your own vessel and you shouldn't have direct control over. This has been fixed. (#1540) Refactored previous non-working technique for quicksave/quickload to turn it into something that works. (#1372) There were cases where using CTRL-C to abort a program would cause some old cruft to still be leftover in the VM's stack. This made the system fail to clear out the names of functions that were no longer loaded in memory, making it act like they were still reachable and call-able. (#1610) Some types of Resource didn't contain the :DENSITY suffix like the documentation claimed they would. (#1623)
Released on 2016-05-16
The biggest reason for this release is to handle two game-breaking problems caused by recent alterations in the API that kOS hadn't adapted to correctly yet.
The "remit" of this release is purely to fix a few bugs, and patch up a few things where KSP 1.1 had changes we didn't catch. Mostly, that's cases where previously working code in kOS had now become a bug, but it also includes a few other bug fixes not related to KSP 1.1.
But any new features (rather than bug fixes) in the pipeline not directly related to that "remit" are not in this release.
STEERINGMANAGER:SHOWENGINEVECTORSare now obsolete and will throw an error.
Released on 2016-04-20
This release is functionally identical to v0.19.3, it is recompiled against the KSP 1.1 release binaries (build 1230)
Released on 2016-04-05
(This is the last planned update to work with KSP 1.0.5 unless it breaks something big that requires an emergency patch.)
onlogic now evaluates expressions and suffixes, instead of requiring a raw variable (https://github.com/KSP-KOS/KOS/issues/1376 https://github.com/KSP-KOS/KOS/pull/1542)
lock throttle...(https://github.com/KSP-KOS/KOS/issues/691 https://github.com/KSP-KOS/KOS/issues/1253 https://github.com/KSP-KOS/KOS/issues/1557 https://github.com/KSP-KOS/KOS/pull/1561)
Released on 2016-03-08
This release is here primarily to fix a problem that made the new v0.19.1 terminal unusable for users who have to use low resolution texture settings in the Unity graphics configuration panel.
Released on 2016-03-06
This release is a patch to v0.19.0, fixing some things found by the user community in the two days shortly after v0.19.0 released.
It also happens to contain a few terminal window features that were being worked on before v0.19.0 but were not deemed ready yet when 0.19.0 was released.
Released on 2016-03-02
waitstatement, it won't use as much power. (http://ksp-kos.github.io/KOS_DOC/general/cpu_hardware#electricdrain)
lockvariables in compiled scripts with a duplicate identifier (like "throttle") throws an error (https://github.com/KSP-KOS/KOS/issues/1347 and https://github.com/KSP-KOS/KOS/issues/1253).
(These are generated from records on Github of anyone who's Pull Requests are part of this release.) (Names are simply listed here alphabetically, not by code contribution size. Anyone who even had so much as one line of change is mentioned.)
Stephan Andreev (ZiwKerman) https://github.com/ZiwKerman Bert Cotton (BertCotton) https://github.com/BertCotton Kevin Gisi (gisikw) https://github.com/gisikw Peter Goddard (pgodd) https://github.com/pgodd Steven Mading (Dunbaratu) https://github.com/Dunbaratu Eric A. Meyer (meyerweb) https://github.com/meyerweb Tomek Piotrowski (tomekpiotrowski) https://github.com/tomekpiotrowski Brad White (hvacengi) https://github.com/hvacengi Chris Woerz (erendrake) https://github.com/erendrake (repository owner) (name not public in github profile) (alchemist_ch) https://github.com/AlchemistCH (name not public in github profile) (tdw89) https://github.com/TDW89
Released on 2016-02-17
run once ...syntax to run a script only once per session ( http://ksp-kos.github.io/KOS_DOC/commands/files.html#run-once-program )
core) ( http://ksp-kos.github.io/KOS_DOC/commands/processors.html )
debuglog(...)function to print directly to the KSP log file ( http://ksp-kos.github.io/KOS_DOC/structures/misc/kuniverse.html#method:KUNIVERSE:DEBUGLOG )
stackdata structures ( http://ksp-kos.github.io/KOS_DOC/structures/misc/queue.html and http://ksp-kos.github.io/KOS_DOC/structures/misc/stack.html )
Raw stats are from the beginning of time until now. Each follower and download entry represents one hour of data. Uneventful hours are omitted.