erendrake Posted February 1, 2014 Share Posted February 1, 2014 (edited) This is a continuation of the Excellent work by Nivekk. Without it, this mod would certainly not exist. What's new CHANGELOG Current Version: 1.1.3.0 - Released 2017/9/18 What is it kOS is a scriptable autopilot Mod for Kerbal Space Program. It allows you write small programs that automate specific tasks. With kOS, you can issue commands to your ships via a command line, or write programs to automate tasks. kOS can interact with other parts on your craft via action groups, it can also be set to run programs in response to action groups being fired. kOS requires Kerbal Space Program 0.90 or later. Where to get it Download the latest version from Curse Download the latest version from Spacedock Releases and Pre-Release Builds are posted on Github Installation Simply merge the contents of the zip file into your Kerbal Space Program folder. Usage Add the Compotronix SCS part to your vessel; it's under the "Control" category in the Vehicle Assembly Building or Space Plane Hanger. After hitting launch, you can right-click on the part and select the "Open Terminal" option. This will give you access to the KerboScript interface where you can begin issuing commands and writing programs. The SCS module requires some electric charge to operate. You can shut it off to save power by right-clicking it and using the "Toggle Power" option. Some commands can be aborted, including programs that you have run. Simply open the terminal and hit control-c to break. This is useful if you accidentally write something that runs forever. Documentation Reference Documentation Other Resources kOS Subreddit - Regular conversation with devs and a lot of code sharing Bug Report / Feature Requests Issue Tracker Changelog License This software is released under the GNU GPL version 3, 29 July 2007. View complete license on GitHub. Edited September 18, 2017 by erendrake Updated to v1.1.3.0 Link to comment Share on other sites More sharing options...
diomedea Posted February 1, 2014 Share Posted February 1, 2014 What about including a mention of the original kOS thread and his author? Being this a derivative work, even taking the same parts of the original mod and the same graphical feel of the original thread, I would strongly consider doing so.Apart from the above, congrats and thanks for your contribution in keeping kOS alive these days. Link to comment Share on other sites More sharing options...
Agathorn Posted February 1, 2014 Share Posted February 1, 2014 @erendrake How would you prefer I handle my Realism fork of kOS? In a separate thread, and just collaborate where it makes sense to do so, or do you want to offer both flavors from here? Link to comment Share on other sites More sharing options...
Agathorn Posted February 1, 2014 Share Posted February 1, 2014 What about including a mention of the original kOS thread and his author? Being this a derivative work, even taking the same parts of the original mod and the same graphical feel of the original thread, I would strongly consider doing so.Apart from the above, congrats and thanks for your contribution in keeping kOS alive these days.I agree. After all, we are building on his work. Link to comment Share on other sites More sharing options...
deadshot462 Posted February 1, 2014 Share Posted February 1, 2014 Will you add the ability to execute "if" or "when" statements at any time rather than in a linear fashion as it used to be? Link to comment Share on other sites More sharing options...
erendrake Posted February 1, 2014 Author Share Posted February 1, 2014 What about including a mention of the original kOS thread and his author? Being this a derivative work, even taking the same parts of the original mod and the same graphical feel of the original thread, I would strongly consider doing so.Apart from the above, congrats and thanks for your contribution in keeping kOS alive these days.I agree completely, I have added a mention of his work. I was considering linking to some of his resources (devblog, github) but i dont want to confuse people. Link to comment Share on other sites More sharing options...
erendrake Posted February 1, 2014 Author Share Posted February 1, 2014 @erendrake How would you prefer I handle my Realism fork of kOS? In a separate thread, and just collaborate where it makes sense to do so, or do you want to offer both flavors from here?Lets talk about it in the development thread i just made http://forum.kerbalspaceprogram.com/threads/68096-kOS-Autopilot Link to comment Share on other sites More sharing options...
erendrake Posted February 1, 2014 Author Share Posted February 1, 2014 Will you add the ability to execute "if" or "when" statements at any time rather than in a linear fashion as it used to be?If you could be a little more specific about what you would like to run and cannot I will try remove artificial limits to the language. Link to comment Share on other sites More sharing options...
deadshot462 Posted February 1, 2014 Share Posted February 1, 2014 If you could be a little more specific about what you would like to run and cannot I will try remove artificial limits to the language.Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)-When TWR > 1.5 Then reduce thrust-When ALT > 5000 Then turn rightRight now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements. Link to comment Share on other sites More sharing options...
erbmur Posted February 1, 2014 Share Posted February 1, 2014 Is there any thought or development into combining the input screen of this with the rastaerpropmonitor mod? Link to comment Share on other sites More sharing options...
erendrake Posted February 1, 2014 Author Share Posted February 1, 2014 Is there any thought or development into combining the input screen of this with the rastaerpropmonitor mod?Not until now! I hadn't really considered the use of KOS with manned missions very much, but something like a space shuttle re-entry is done mostly by computer so i dont see why not. Link to comment Share on other sites More sharing options...
TomatoSoup Posted February 1, 2014 Share Posted February 1, 2014 Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)-When TWR > 1.5 Then reduce thrust-When ALT > 5000 Then turn rightRight now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.Basically, your problem is that When acts like a "Wait until this condition is met, Then proceed" Link to comment Share on other sites More sharing options...
erbmur Posted February 1, 2014 Share Posted February 1, 2014 Not until now! I hadn't really considered the use of KOS with manned missions very much, but something like a space shuttle re-entry is done mostly by computer so i dont see why not.HURRAY!!!!As well as space shuttles, I've started playing only through IVA, so I was using KOS for setting up maneuver nodes as well as launching probes, and was hoping that at some point I would be able to save on screen real estate by integrating the code window into one of the screens present in the cockpit. Link to comment Share on other sites More sharing options...
erendrake Posted February 1, 2014 Author Share Posted February 1, 2014 Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)-When TWR > 1.5 Then reduce thrust-When ALT > 5000 Then turn rightRight now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.So some kind of callback that will do something the first time a condition is met? Link to comment Share on other sites More sharing options...
Mecripp Posted February 1, 2014 Share Posted February 1, 2014 @erendrake have you seen the new http://forum.kerbalspaceprogram.com/threads/54925-WIP-ALCOR-Advanced-Landing-Capsule-for-Orbital-Rendezvous-by-ASET-%28UPD-10-01-2014%29 the rastaerpropmonitorto the right as a kos pad on it,Don't know if it's a dummy pad or not. Link to comment Share on other sites More sharing options...
Agathorn Posted February 1, 2014 Share Posted February 1, 2014 (edited) Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)-When TWR > 1.5 Then reduce thrust-When ALT > 5000 Then turn rightRight now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.So some kind of callback that will do something the first time a condition is met?This is actually a much more complicated issue than it sounds on the surface. The reason it works like it does is mostly due to "typical" language constructs. While kerbalscript is unlike any other language i've seen, it still under the hood follows the way most normal programming and scripting languages work.When you say "when TWR > 1.5 then reduce thrust", what you are actually saying is akin to "wait until TWR > 1.5", which blocks program execution, and since kOS isn't multi-threaded, you can't spawn that off in a separate thread.set done to 0.until done = 2{ if TWR > 1.5 { lock throttle to 0.5. set done to done + 1. } if altitude > 5000 { lock steering to heading 90 by 45. set done to done + 1. }}is more akin to what you are saying, in kerbalscript.To make it work like you want above really goes against standard paradigms. It could be done, like erendrake says, by introducing the concept of events or callbacks, or it could be achieved by allowing you to spawn subprograms into a sperate execution thread. The problem with the former is its a pretty big overhaul of the language. The problem with the former is that multi-threaded concepts get complicated quickly for the uninitiated, and then you start having to deal with locking, race conditions, etc, though some of the issues could be reduced by strict limitations placed on kOS code, then people might get frustrated at the limits. Edited February 1, 2014 by Agathorn Added code in code block for clarity Link to comment Share on other sites More sharing options...
Agathorn Posted February 1, 2014 Share Posted February 1, 2014 Not until now! I hadn't really considered the use of KOS with manned missions very much, but something like a space shuttle re-entry is done mostly by computer so i dont see why not.To be fair, what manned space flight *didn't* have a computer assisted something? Link to comment Share on other sites More sharing options...
deadshot462 Posted February 1, 2014 Share Posted February 1, 2014 Good informative posts about that issue. I figure there are ways around it like putting "when" statements inside each other, but I figured i'd point it out anyway to see how feasible an update it was. Link to comment Share on other sites More sharing options...
razark Posted February 1, 2014 Share Posted February 1, 2014 I'd love to see a way to have a terminal window outside of KSP, or even a server set-up, where you can telnet into it and operate the computer. Link to comment Share on other sites More sharing options...
Mecripp Posted February 1, 2014 Share Posted February 1, 2014 I'd love to see a way to have a terminal window outside of KSP, or even a server set-up, where you can telnet into it and operate the computer.Something like Telemachus mod ? Link to comment Share on other sites More sharing options...
Agathorn Posted February 1, 2014 Share Posted February 1, 2014 Personally I think you should be able to go into the mission control building and type up code for the Archive Link to comment Share on other sites More sharing options...
MSD Posted February 1, 2014 Share Posted February 1, 2014 Dont forget you can use an infinite loop... Than check for condition a and b.. Do what they need to do, and jump out of the loop to continue the program. Link to comment Share on other sites More sharing options...
razark Posted February 1, 2014 Share Posted February 1, 2014 Something like Telemachus mod ?Unless Telemachus has added a command line interface, no.I want to be able to open a connection and run commands the same way I currently do in the kOS terminal window. Telnet to IP and port, and interact as usual. Link to comment Share on other sites More sharing options...
theSpeare Posted February 2, 2014 Share Posted February 2, 2014 Razark can you post a tutorial of how to do that please? Also can you guys speak to Cilph about proper integration of kOS into RT? Link to comment Share on other sites More sharing options...
Mecripp Posted February 2, 2014 Share Posted February 2, 2014 (edited) KOS had a mod that run in windows to make scrip or edit them if you could tie that in to ksp like Telemachus did don't see why you couldn't.http://forum.kerbalspaceprogram.com/threads/47693-WIN-the-kOS-IDE-Current-version-0-33 Edited February 2, 2014 by Mecripp2 Link to comment Share on other sites More sharing options...
Recommended Posts