CLEARSCREEN. // Clear the screen NOTIFY("Ascent software ready."). FUNCTION getAscentAngle { PARAMETER targetHeight. RETURN 90 - ((altitude / targetHeight) * 90). } // Lock throttle to 1, (throttle up) LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. // 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. // 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 > 20 // This is bad, we've started to fall down. { PRINT NOTIFY("We broke out of the ascent loop! If thats a good thing you'ld know."). } ELSE { LOCK STEERING TO HEADING(90,(getAscentAngle(100000))). STAGE. } PRINT "Waiting for ship to reach 100000". UNTIL SHIP:APOAPSIS >= 100000 { WAIT 0.5. } WAIT 0.5. // Run this loop every half second. 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