Nivekk / KOS

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

Provide semantic to remove all nodes #226

Open baloan opened 10 years ago

baloan commented 10 years ago

When debugging a script I repeatedly need to remove all nodes. I intuitively tried:

until nextnode = 0 {  // also tried: until not nextnode {
    remove nextnode.
}

which fails because nextnode prints "no maneuver nodes present" and aborts the script. Please provide a way to make nextnode compatible with loops.

a1270 commented 10 years ago

One way would be to add 'COUNT' to the node structure or as external command.

until nextnode:count == 0
{
  remove nextnode.
}

Another is to add a NOT/! boolean comparative. Don't think this'll work with the node type. May be on my mind as i am working on adding this.

until !nextnode
{
 remove nextnode.
}.

Third way i can think being a REMOVE ALL command. This may be a bit dangerous.

remove all.
Nivekk commented 10 years ago

I wouldn't do REMOVE ALL because we may have ADD and REMOVE operate on different objects in the future, but maybe REMOVE ALL NODE