Skip to content

Return 0 if vessel is on escape trajectory. Since KSP recalcs the orbit ... #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

a1270
Copy link
Contributor

@a1270 a1270 commented Nov 16, 2013

...constantly it returns random results during escape. Somewhat address #248. Probably need to work about a policy on return values. I have currently been doing "None" for strings and 0 for numbers. I'll continue down that route until told otherwise.

…it constantly it returns random results during escape. Somewhat address #248
@Dunbaratu
Copy link
Contributor

For the idea of what to return when the answer is nonsensical I think what I'd prefer is a way that KOS script can check against NULL, and then you can return NULL for all such scenarios and it makes more logical sense that way.

if ENCOUNTER = NULL { print "no encounter coming". }.
if APOAPSIS = NULL { print "no apoapsis.  escape trajectory?".}.
if TARGET = NULL { print "no target selected.".}.

That would provide one generic way to do it that the user always knows works, and also would solve the type checking issue.as NULL is the one thing you would always be able to check against no matter what the object's type is.

@baloan
Copy link

baloan commented Nov 16, 2013

I don't like "NULL" as its origin is deeply rooted in pointer-using programming languages. kOS script is much more high-level (like BASIC). "None" as originally chosen makes more sense to me. As a convenience feature we might add None to match "None" (string) in comparisons (like when body is compared to Kerbin or Mun) .

@Dunbaratu
Copy link
Contributor

I frankly don't care what it's called (and languages that the safer concept of references instead of calling them pointers still ALSO use NULL or NIL ).

But what I'm talking about here is a way to say 'is this value meaningful right now or is it a dummy?" that works universally regardless of what type of thing is is. "None" only works with code that is expecting a string. And the number zero only works for numbers for which zero wouldn't also be a valid meaningful value.

If you don't want to call it NULL and want to call it None instead I don't care. It's the same concept either way.

@JoCRaM
Copy link

JoCRaM commented Nov 29, 2013

Is it random? I dislike discarding data just because we don't quite understand it. Are you sure you're not discarding periapsis before we've reached it (e.g. a slingshot)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants