Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake
 Share

Recommended Posts

Just now, xel'lotath said:

I'm afraid I don't know what you mean - CheersKevin's script starts off with a RUN command too, without parameters. How do I add these parameters? Sorry if I'm being dense.

Wait, I misread your scripts the first time.

It's getting into territory I haven't particularly trod in; I've gone for monolithic scripts without much in the way of functions, mostly because I've only really needed single-purpose scripts (such as "execute maneuver node" or "point telescope at thing").

My only kinda-guess is that launch.ks doesn't have access to the EXECUTE_ASCENT_PROFILE method of ascent.ks, and is freaking out as a consequence. I'll have to look into how kOS handles importing libraries and methods from other files, though hopefully someone else will come along who's done that kind of work before.

Link to comment
Share on other sites

6 hours ago, xel'lotath said:

Wow, thanks for the quick response. The solution to the TWR issue worked great - I guess the lesson for me is to make sure sure I know exactly what terms like SET and LOCK mean before I use them.

SET: assign the value to the variable right now, and just leave it at that value from now on (until the next SET command for that variable).

LOCK: every time some part of the script asks what the value of the variable is, the math expression gets re-run again to find the new answer.
 

SET X to 10.
SET BLAH TO X/2. //SET command
print BLAH.
SET X TO 20.
print BLAH.
SET X TO 30.
print BLAH.

// Result of the above looks like this:
// 5
// 5
// 5

SET X to 10.
LOCK BLAH TO X/2. //LOCK command
print BLAH.
SET X TO 20.
print BLAH.
SET X TO 30.
print BLAH.

// Result of the above looks like this:
// 5
// 10
// 15

// Doing it with the LOCK is the same, essentially, as doing this:
SET X to 10.
FUNCTION BLAH {
  RETURN X/2.
}
print BLAH().
SET X TO 20.
print BLAH().
SET X TO 30.
print BLAH().

Quote

I'm afraid I don't know what you mean - CheersKevin's script starts off with a RUN command too, without parameters. How do I add these parameters? Sorry if I'm being dense.

//Contents of prog1.ks

parameter p1, p2, p3.

print "Hi, I'm prog1.  The person who ran me gave me these parameters:".
print p1.
print p2.
print p3.
// Typing this at the terminal interactive prompt:
RUN prog1("apples", 10, 7.5).
// Responds with this:
Hello, I'm prog1.  The person who ran me gave me these parameters:
apples
10
7.5

 

Link to comment
Share on other sites

3 minutes ago, xel'lotath said:

Thanks for your help.

So how do I apply this to my script?

For the life of me, I can't figure out what's wrong. You might try dumping the contents of "ap" to the terminal just before calling the EXECUTE_ASCENT_PROFILE method, so you know exactly what's being passed.

When in doubt: throw print statements everywhere.

Link to comment
Share on other sites

I found the problem, and it was really dumb. I had what I thought was ascent.ks saved under a different name, ascent_b.ks. The file saved under ascent.ks was an older version with a fourth parameter, newThrust. So when launch.ks ran ascent.ks, it didn't match up. Sorry for wasting your time with that one.

Link to comment
Share on other sites

Pre-release v1.0.90

for KSP v1.2.2 Downloads this release

kOS has released v1.0.90 ahead of the next full release (v1.1.0). We are asking users to please help us with testing new features, as well as regression testing old features. To download the pre-release, and to view the changelog, please visit https://github.com/KSP-KOS/KOS/releases/tag/v1.0.90  This release will not be made available via ckan, spacedock, or curse.

You can also find the temporary documentation at http://hvacengi.github.io/KOS/

Edited by hvacengi
Link to comment
Share on other sites

15 hours ago, hvacengi said:

Pre-release v1.0.90

kOS has released v1.0.90 ahead of the next full release (v1.1.0). We are asking users to please help us with testing new features, as well as regression testing old features. To download the pre-release, and to view the changelog, please visit https://github.com/KSP-KOS/KOS/releases/tag/v1.0.90  This release will not be made available via ckan, spacedock, or curse.

You can also find the temporary documentation at http://hvacengi.github.io/KOS/

Is it for KSP pre-release version or it is "pre-release" for kOS update ? On what KSP version should be tested ?

I did quick read trough documentation and changelog, but I didn't found info about it. Didn't have enough time to read trough all issues/PR on github.

Link to comment
Share on other sites

1 hour ago, kcs123 said:

Is it for KSP pre-release version or it is "pre-release" for kOS update ? On what KSP version should be tested ?

I did quick read trough documentation and changelog, but I didn't found info about it. Didn't have enough time to read trough all issues/PR on github.

It is for KSP 1.2.2.

It's a pre-release of kOS, for the CURRENT release of KSP.

Link to comment
Share on other sites

2 hours ago, kcs123 said:

Is it for KSP pre-release version or it is "pre-release" for kOS update ? On what KSP version should be tested ?

I did quick read trough documentation and changelog, but I didn't found info about it. Didn't have enough time to read trough all issues/PR on github.

I've added the KSP version to my original post here, but it should have already been highlighted on the top of the changelog for the github release page.  If you aren't seeing that image, please let me know and I'll make sure that we get it fixed.

Link to comment
Share on other sites

Picture is there, in both, your post and on github. I guess I missed it when I was reading change log. I was searching for some piece of info in text and disregaded picture somehow. Thanks for clarification, helps with not producing false reports if I pick wrong KSP version.

Link to comment
Share on other sites

On 5/16/2017 at 5:04 PM, kcs123 said:

Picture is there, in both, your post and on github. I guess I missed it when I was reading change log. I was searching for some piece of info in text and disregaded picture somehow. Thanks for clarification, helps with not producing false reports if I pick wrong KSP version.

I'd be curious to know what errors you do find if you run it with the wrong KSP version.  Because we're prepping for our 1.1.0 release, and because I had an extended hiatus, we haven't done a lot to prepare for the new release.  But I'm sure that there will be plenty of small bugs to fix.

Link to comment
Share on other sites

Well, I'm on hiatus from playing KSP for months, but I hope I could get some free time over weekend to test GUI. Last time I was try to use it it was hard to follow everything. Waz have being doing changes back and forth for GUI with forked non latest version of kOS. I have to give it a try when everything is merged. IIRC, group of 3 or more radio buttons were not working properly in latest alpha version of GUI, while it worked properly in previous alpha versions. Need to check that.

Also, I think that I was using version for KSP 1.2.2. on KSP 1.2.1. without noticable issues, but like I said, it is better to test it on platform that is designed for.

Link to comment
Share on other sites

  • 2 weeks later...
1 minute ago, scorpianz1525 said:

Any update for 1.3?

It updates when it updates.

Note the sticky post:

It's not even remotely time to even be slightly impatient; it has not even been a week. FAR didn't update for KSP 1.2 until this week, and it's been around half a year since KSP 1.2 was released.

Link to comment
Share on other sites

On 2017-5-27 at 1:38 AM, Starman4308 said:

It updates when it updates.

Note the sticky post:

It's not even remotely time to even be slightly impatient; it has not even been a week. FAR didn't update for KSP 1.2 until this week, and it's been around half a year since KSP 1.2 was released.

Ok thanks, I only thought this was a small update so didn't require any real work just recompile really but idk. Thanks for the reply tho

Link to comment
Share on other sites

  • 2 weeks later...

Question:

how do I lock steering, relative to a specific part, independend of "control from here". 

Problem: my spacestation sometimes turnes around when something docks, because the contolpoint changes.

I image somelike like

lock diff to ctrlpart:facing * mypart:facing.

lock steer to prograde * diff.

but thats wrong, how to do this?

Link to comment
Share on other sites

22 hours ago, sebseb7 said:

Question:

how do I lock steering, relative to a specific part, independend of "control from here". 

Problem: my spacestation sometimes turnes around when something docks, because the contolpoint changes.

I image somelike like

lock diff to ctrlpart:facing * mypart:facing.

lock steer to prograde * diff.

but thats wrong, how to do this?

i use a kos script that dos part:CONTROLFROM when ship:PARTS:LENGTH<>old-PARTS-LENGTH

i use MM to add kos(2K space) to all porbs and command pods

Edited by danielboro
Link to comment
Share on other sites

v1.1.0 Released  - this is the final release for KSP 1.2.2.  (Next release will be for KSP 1.3, unless there's a big problem with this release).

 

"Everything's all GUI"

 

Available at the usual places,

CurseForge

SpaceDock

GitHub

 

 

(I'm not going to take the time to reformat this changelog into the forums's WYSIWYG system - so I'll just paste it as a code snippet:)
 

### BREAKING CHANGES
- Because of changes to make the terminal use a real font from your OS, we had
  to obsolete TERMINAL:CHARWIDTH.  You can only choose TERMINAL:CHARHEIGHT.
  Each font has its own hardcoded notion of how wide a letter will be at a
  given height, which you can't override.
- CONFIG:BRIGHTNESS was moved back to the global config section, and is no longer
  set on the "difficulty" options screen, because it's not supposed to be a
  per-saved-game setting, but a user-interface preference that spans all saved games.
- ATM:SEALEVELPRESSURE now gives the answer in different units than it used to.
  (It was in KiloPascals even though the documentation claimed it was in atmospheres.
  Now it's in atmospheres to agree with the documentation.)

### NEW FEATURES
- **GUI-making toolkit**. You are now able to make a GUI window that your kerboscript
  code can control, including buttons, sliders, toggles, checkboxes, etc.  It uses the
  KSP game's default skin (kind of big letters) but the skin can be customized by the
  script a bit to change things.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1878)
  [pull request](https://github.com/KSP-KOS/KOS/pull/2006)
  documentation: search for "GUI" (http://ksp-kos.github.io/KOS_DOC/structures/gui.html).
- **Background compilation**.  Now the game continues its simulation normally and physical
  events keep happening, while kOS is taking a few seconds to compile a script.
  (Gets rid of that familiar frozen game effect when you first issue a ``RUN`` command.)
  [pull request](https://github.com/KSP-KOS/KOS/pull/1941)
- **Terminal Font**.  Now the kOS in-game terminal window uses a real font from your OS itself
  to render the text terminal.  (This allows the display of any Unicode character the font can
  render, and it allows nicer looking font size changes.)  Previously kOS painted images for
  letters from a hardcoded texture image file.
  [pull request 1](https://github.com/KSP-KOS/KOS/pull/1948)
  [pull request 2](https://github.com/KSP-KOS/KOS/pull/2008)
- **Allow any unicode**.  The kerboscript parser now allows identifiers and literal strings to
  contain letters outside the limited ASCII-only range it used to accept.  The in-game terminal now
  allows you to type any letter your keyboard can type.  (But it does not implement the ALT-numpad
  technique of entering characters.  You have to have a keyboard that types the character directly.
  However, the ALT-numpad technique will work through the telnet terminal, if your telnet client's
  window can do it.)
  [pull request](https://github.com/KSP-KOS/KOS/pull/1994)
- **Regular expression part searches** for part/tag names.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1918), documenation: search for "PARTSTAGGEDPATTERN" (http://ksp-kos.github.io/
KOS_DOC/structures/vessels/vessel.html#method:VESSEL:PARTSTAGGEDPATTERN).
- **Choose the IP address** of the telnet server, from the ones your computer has available, instead
  of kOS picking one arbitrarily.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1976)
- **Allow local variables in triggers** In order to support the kOS callback
  system used by the GUI, we also finally had to add support for proper local
  variable scoping to triggers like WHEN and ON.  A trigger's condition
- **Pressure at a given altitude** is now something you can query from an atmosphere.
  [pull request](https://github.com/KSP-KOS/KOS/pull/2000), documentation: search for "ALTITUDEPRESSURE" (http://ksp-kos.github.io/K
OS_DOC/structures/celestial_bodies/atmosphere.html#method:ATMOSPHERE:ALTITUDEPRESSURE).
- **Get a LATLNG for some other body than the current one.**
  [pull request](https://github.com/KSP-KOS/KOS/pull/2001), documentation: search for "GEOPOSITIONLATLNG" (http://ksp-kos.github.io/
KOS_DOC/structures/celestial_bodies/body.html#method:BODY:GEOPOSITIONLATLNG).

### BUG FIXES
- Fix kOS toolbar button sometimes failing to appear in Blizzy Toolbar Mod.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1902)
- Fix SKID Chip emulator's sync lag when physics is slow.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1915/commits/c9d9dcd18561903e122531605194b2685fc4fb15)
- Fix SKID Chip emulator unable to use voices 6 through 9 because of how they were initialized.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1927)
- Forgot to document GETMODULEBYINDEX.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1962)
- Fix inability of a script to SET TARGET when KSP game is not the focused window.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1934)
- Fix iterator that lets you walk the characters in a string with "for" loop.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1938)
- Removed some Unity hooks that despite being empty and doing nothing,
  nonetheless still ate up a bit of time to pointlessly call and return from.
  [pull request](https://github.com/KSP-KOS/KOS/pull/1965)
- Fix use of the min()/max() function on string comparisons
  [pull request](https://github.com/KSP-KOS/KOS/pull/1967)
- Fix science data transmissions
  [pull request](https://github.com/KSP-KOS/KOS/pull/1979)
- Fix unnessary duplicated of clones of vessel objects (was causing large garbage collection hangs).
  [pull request](https://github.com/KSP-KOS/KOS/pull/1983)
- Fixed several small documentation errors:
  [pull request](https://github.com/KSP-KOS/KOS/pull/1928)
  [pull request](https://github.com/KSP-KOS/KOS/pull/1986)
  [pull request](https://github.com/KSP-KOS/KOS/pull/1992)
- Fixed float->boolean mapping error.  The values no longer round to integer before becoming boolean.
  (i.e. 0.01 should be True, not get rounded to False (0) like it used to.)
  [pull request](https://github.com/KSP-KOS/KOS/pull/1990)
- Fixed ATM:SEALEVELPRESSURE units to agree with the documentation.
  [pull request](https://github.com/KSP-KOS/KOS/pull/2000)
- Fixed bug that had made the sounds fail to emit for beep and keyclick.
  [pull request](https://github.com/KSP-KOS/KOS/pull/2003)
- Fixed vessel:TOSTRING to return "Vessel(blarg)" instead of "Ship(blarg").
  [pull request](https://github.com/KSP-KOS/KOS/pull/2005)
- Fixed null-ref errors when using NEXTPATCH when there is no next patch.
  [pull request](https://github.com/KSP-KOS/KOS/pull/2009)
- Fixed a few bugs related to kOS cleaning up after itself when the vessel splits into two
  or two vessels join together, or a vessel blows up.
  [pull request](https://github.com/KSP-KOS/KOS/pull/2010)

 

Edited by Steven Mading
Link to comment
Share on other sites

  • 2 weeks later...

Author sir, all the time, kOS lacks some an effective way to get the overheat information of parts.
kOS players have no way to get heat alarm. They have no chance to make something to avoid overheating explosion.
Please, shall we change this situation?

Suggestion:

How about adding a new scalar field named "OverHeat" into structure PART ?
"OverHeat" stands for a overheat bar of the part.
Its range can be 0.0 to 1.0. Zero value means the part's temperature is safe.

Also, how about adding a new list named "OverHeatParts" into structure VESSEL ?
It will be a list of all parts with dangerous temperature.

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Sorry for late response. Did not play too often now.

I tested kOS on 1.3 and unable to use russian letters. No matter chosen font.

Is it a problem with seven bite byte somewhere or should I somehow teach KSP/kOS to know Russian? How?

Link to comment
Share on other sites

16 hours ago, Sebra said:

Sorry for late response. Did not play too often now.

I tested kOS on 1.3 and unable to use russian letters. No matter chosen font.

Is it a problem with seven bite byte somewhere or should I somehow teach KSP/kOS to know Russian? How?

All I did for my testing was try to print out some Unicode codes of a few Cyrllic letters, for example:

print char(1103). // Unicode 0443hex, "Я"

print char(1041). // Unicode 0411hex, "Б"

etc...

It's possible there is another standard used in Russian fonts that doesn't match Unicode conventions, but if so then I don't know much about it.  I don't speak Russian.

The first test is to ensure the font chosen actually has the Unicode characters in this range populated (Hex 0401 through Hex 04FF).  Not all of them do.

The second problem might be that the keyboard sends codes that uses a different standard than Unicode.  Again, I've never used a Russian keyboard so I don't know how it works.

The third possible problem could be a mistake in kOS where keyboard codes might be getting cut off if they are out of the expected range.  I thought I got all the places that expected only 7-bit ascii and removed the limitation, but without an actual Russian keyboard to test with I don't know if I missed something.

Can you describe the exact problem you are seeing?

Is it this: "I try to type a Russian letter on my keyboard and nothing happens."?

Or is it this: "I try to type a Russian letter on my keyboard and I get a letter on the screen, but it's a different letter than the one I typed."?

Also, is it using the in-game terminal or is it using telnet?  If it's using Telnet it might not be using the right encoding to send the characters down the line.

 

Link to comment
Share on other sites

Tested this issue - results with Russian keyboard are as follows:

  • You can type Russian in script editing interface (well, this worked before as well).
  • Terminal now displays correctly if the script prints something in Russian
  • However, typing Russian directly into the terminal (from Russian layout on keyboard) ends in something strange. It's not QWERTY, it's not ЙЦУКЕН (that's what Russian layout starts with), it's some messed up bunch of symbols (mostly Latin, numbers and other symbols you can find on English keyboard) and in some cases (more often for capital letters) you may get nothing typed at all.
  • Also tried one extended Latin layout (it types an altered letter if you type a particular symbol before pressing the letter key). The same mess with those extra symbols.

Sounds like the claim of the terminal supporting the input if the keyboard can type a particular symbol is not really true. Something gets messed up on the way

Link to comment
Share on other sites

So , I have a falcon 9 replica script that can do a RTLS somewhat well. No problems with boostback,entry burn , hoverslam whatsoever . Though the life of me i can't figure out a way to land within a 50m radius . What logic (+Code example / maths explained if possible) do you guys use to nail those tight ASDS landings? or put this way , tell your rocket to steer itself into a point using engine gimballing and if possible , body lift ?

Edited by Alpha_Mike_741
Link to comment
Share on other sites

14 hours ago, Steven Mading said:

print char(1103). // Unicode 0443hex, "Я"

This works good.

print terminal:input:getchar().

works bad.

14 hours ago, Steven Mading said:

"I try to type a Russian letter on my keyboard and I get a letter on the screen, but it's a different letter than the one I typed."?

Exactly!

For example "абвгд" typed gives me "01234". ( ascii less by 112 , unicode less by 0400 ).

14 hours ago, Steven Mading said:

The third possible problem could be a mistake in kOS where keyboard codes might be getting cut off if they are out of the expected range.  I thought I got all the places that expected only 7-bit ascii and removed the limitation, but without an actual Russian keyboard to test with I don't know if I missed something.

It seems unicode need more than 8 bits :wink:

14 hours ago, Steven Mading said:

Also, is it using the in-game terminal or is it using telnet?  If it's using Telnet it might not be using the right encoding to send the characters down the line.

In-game. I do not even know if some terminals use unicode.

2 hours ago, Alchemist said:

You can type Russian in script editing interface (well, this worked before as well).

Yes.

2 hours ago, Alchemist said:

Terminal now displays correctly if the script prints something in Russian

Yes. But after save/load game letters become question marks "?". (not on archive).

 

Edited by Sebra
Tested more.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...