Jump to content

KOS basics


kerbinorbiter

Recommended Posts

so KOS is a mod for KSP people do find it hard to understand so I'm going to do some of the basics and if you wish the advanced 

so first the basics:

print "hello world".  //prints hello world on screen

 the // is the format to say to KOS don't read this as code

lock throttle to 1. //same as pressing the Z key

lock steering to up. //points the craft directly up

lock steering to retrograde +r(0,-20,0).

locks steering to retrograde with a pitch of 20 degrees above on the pitch

Lock steering to heading(90,0).

// I use this a lot now because it doesn't have the confusing rotational rules the lock steering to up +r(0,-20,0) has this example points 90 heading and 0 pitch and 0 roll

lock throttle to 0. //same as pressing x on your keyboard 

wait 3. //waits 3s

wait until ETA:APOAPSIS < 15. Waits 15 seconds until apoapsis You can do this with the periapsis too

set y to 90.

//sets variable y to 90

i think this is the basics

 

Edited by kerbinorbiter
Link to comment
Share on other sites

@kerbinorbiter, you mean this:

print "hello world".  //prints hello world on screen

lock throttle to 1. //same as pressing the Z key

lock steering to up. //points the craft directly up

lock steering to retrograde +r(0,-20,0). // locks steering somewhere retrograde-ish (rotations, or directions are really crazy)

Lock steering to heading(90,0). // The way directions are probably intended to be used

lock throttle to 0. //same as pressing x on your keyboard 

wait 3. //waits 3s

wait until ETA:APOAPSIS < 15. //Waits 15 seconds until apoapsis You can do this with the periapsis too

set y to 90. // sets variable y to 90 

?

(please use the code formatting with the <> button)

And what you really forgot to mention is that every command must end with a period. And, if you started with mathematical operations on rotations, what is the difference between retrograde+R(0,-20,0) and retrograde*R(0,-20,0).

Link to comment
Share on other sites

7 hours ago, Pand5461 said:

@kerbinorbiter, you mean this:


print "hello world".  //prints hello world on screen

lock throttle to 1. //same as pressing the Z key

lock steering to up. //points the craft directly up

lock steering to retrograde +r(0,-20,0). // locks steering somewhere retrograde-ish (rotations, or directions are really crazy)

Lock steering to heading(90,0). // The way directions are probably intended to be used

lock throttle to 0. //same as pressing x on your keyboard 

wait 3. //waits 3s

wait until ETA:APOAPSIS < 15. //Waits 15 seconds until apoapsis You can do this with the periapsis too

set y to 90. // sets variable y to 90 

?

(please use the code formatting with the <> button)

And what you really forgot to mention is that every command must end with a period. And, if you started with mathematical operations on rotations, what is the difference between retrograde+R(0,-20,0) and retrograde*R(0,-20,0).

its that KSP's own internal rotation system says that a - rotation is a positive up rotation its confusing but thats due to the wway that KSP works with it internaly, its strange i know it is its just somthing that needs mentioning 

Link to comment
Share on other sites

6 hours ago, kerbinorbiter said:

its that KSP's own internal rotation system says that a - rotation is a positive up rotation its confusing but thats due to the wway that KSP works with it internaly, its strange i know it is its just somthing that needs mentioning 

Well, rotation and direction stuff is not "basic" for a total newbie.

For example, which exact orientation will a rocket have after "lock steering to up."?

Well, the nose will be pointing upwards, right? But then, assuming the rocket has a Mk1 capsule, which way is the hatch pointed?

Another example. If we can "lock steering to up" and "lock steering to retrograde + something", then can we "lock steering to up + something"? And "lock steering to up + retrograde"? And if we can do the latter, then where will the ship point its nose after that?

It's very good you are willing to help people with basics in kOS. But the thing that you've written are not explaining anything to a newbie, I'm afraid. It's just a bunch of unrelated lines of code taken from out of nowhere.

Just start slower. Begin with the simplest tasks, but give more details on them.

At the very beginning, I as a newbie would expect the info where to enter kOS commands. Then simplest commands.

E.g., let's start with throttle. Throttle is controlled by the "THROTTLE" variable, and changing this variable has the same effect as pressing Shift and Ctrl on the keyboard. The value is a floating-point number between 0 and 1. If we execute command "LOCK THROTTLE TO 0." then we see gauge on navball moved to the shutdown, at "LOCK THROTTLE TO 0.7." gauge moves back up. "LOCK THROTTLE TO 1." is therefore has the same effect as pressing Z on the keyboard.

But we have not started the engine yet. To start the engine, in normal game you press Spacebar. In kOS, this action is conveniently represented by the "STAGE" command.

... and so on and so forth ...

Link to comment
Share on other sites

20 hours ago, kerbinorbiter said:

lock steering to retrograde +r(0,-20,0).

// locks steering to retrograde with a pitch of 20 degrees above on the pitch

 

Correction: That -20 is pitch above the horizon if and only if you're at the equator at the time you run this, and are trying to point east.

It's a rotation around the game's Y axis, which it always aligns with the SOI body's north pole axis.  If you happen to be at the equator, this will be a vector parallel to the ground.  If you're at, say, 45 degrees latitude, then it won't be.

Edited by Steven Mading
Link to comment
Share on other sites

3 hours ago, Steven Mading said:

Correction: That -20 is pitch above the horizon if and only if you're at the equator at the time you run this, and are trying to point east.

It's a rotation around the game's Y axis, which it always aligns with the SOI body's north pole axis.  If you happen to be at the equator, this will be a vector parallel to the ground.  If you're at, say, 45 degrees latitude, then it won't be.

Yeah KSP is quite confusing with its rotation system also the reason why I did this was because it doesn't tell you the rotational direction examples

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...