Code suggestions from the kOS design patterns page.
WAIT UNTIL condition
- stop the script from executing, wait until something is true, then do itWHEN condition THEN
- keep executing the script, keep checking if something is true in the background, then do it when trueUNTIL condition
- keep checking if something is true in the background and keep doing something until it is true
WHEN condition THEN
are expected to complete inside a single physics tick, so don't wait in them, or do major looping in them- Never put an
UNTIL condition
inside of aWHEN condition THEN
- Avoid having tons of conditions being checked at the same time; one way to do this is to next
WHEN condition THEN
statements inside of each other as much as possible WHEN
triggers don't fire if the program has ended! The program ends if there are no more waits.- Beware the combination of
lock STEERING
and SAS. These are independent inputs to the controls and they fight each other. So if you leave steering locked on some vector, and then turn on stability assist, your craft will act like it's insane. To fix this, remove the undesirable input, eitherunlock STEERING.
orSAS off.
.