Nivekk / KOS

Fully programmable autopilot mod for KSP.
Other
80 stars 30 forks source link

UNTIL broken in 0.83 #130

Closed Rauthskegg closed 10 years ago

Rauthskegg commented 10 years ago

In addition to the LOCK issue with STEERING, I noticed that my launch script wasn't staging correctly. I switched back to 0.71 to confirm the issue wasn't present there. This is the effected piece of the script. The first command after this loop is a STAGE, so something about kOS 0.83 keeps this loop from ending.

set turn to 0.

// Stage 1
until stage:liquidfuel < 2700 {
  if altitude > 10000 and turn = 0 {
    lock steering to heading 90 by 40.
    set turn to 1.
    print clearline at(8,4).
    print "Gravity turn" at(8,4).
  }.
  if alt:apoapsis > 70000 and turn < 2 {
    lock steering to prograde.
    lock throttle to (0.9008402139^(alt:apoapsis/100000)).
    set turn to 2.
    print clearline at(8,4).
    print "Final orbital turn" at(8,4).
  }.
  print apoapsis at(0,1).
  print periapsis at(20,1).
  wait .5.
}.
Nivekk commented 10 years ago

Okay, I've worked all night on fixing up both and stage:liquidfuel

It's not so much the until statement at fault, and moreso values that aren't getting updated when assigned to temporal commands like WHEN or UNTIL.

I've pushed some code that seems to fix this, and this worked:

set x to stage:liquidfuel.
lock throttle to 1.
until stage:liquidfuel < x - 10
{
     print "still in loop".
}
unlock throttle.
print "done".

I've put it up on spaceport as 0.84