43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
CLEARSCREEN. // Clear the screen
|
|
|
|
NOTIFY("Ascent software ready.").
|
|
|
|
// Lock throttle to 1, (throttle up)
|
|
LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle.
|
|
|
|
// Countdown from 10!
|
|
NOTIFY("Counting down:").
|
|
FROM {local countdown is 10.} UNTIL countdown = 0 STEP {SET countdown to countdown - 1.} DO {
|
|
NOTIFY(countdown, 1). // Notify the countdown number and keep the number for 1 second.
|
|
WAIT 1. // pauses the script here for 1 second.
|
|
}
|
|
|
|
// First goal should be to get into space,
|
|
// I found this rule of thumb expression "
|
|
// (altitude*23.3/body:atm:height)^0.7*15.
|
|
// on reddit. It looks good enough!
|
|
|
|
CLEARSCREEN. // Clear the screen.
|
|
|
|
SET MYSTEER TO HEADING(90,90). // Default to up
|
|
LOCK STEERING TO MYSTEER. // Set steering to the value of MYSTEER, when it updates so will our steering.
|
|
|
|
UNTIL false { // Run forever
|
|
|
|
SET MYSTEER TO HEADING(90,(altitude*23.3/body:atm:height)^0.7*15).
|
|
|
|
// One of these conditions must be met to call a break in this ascent!
|
|
IF SHIP:APOAPSIS > 100000 // This is good! We made it to space!
|
|
OR SHIP:VERTICALSPEED > 0 // This is bad, we've started to fall down.
|
|
{
|
|
BREAK.
|
|
}
|
|
|
|
WAIT 0.5. // Run this loop every half second.
|
|
}
|
|
|
|
NOTIFY("We broke out of the ascent loop! If thats a good thing you'ld know.").
|
|
|
|
LOCK THROTTLE TO 0. // Throttle back
|
|
SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. // Protects the throttle from "jumping" when we hand control back to the pilot
|