zeta function

kos altitude trigger question

Recommended Posts

I am new to this mod, and i am trying to make it so that my craft stages once at a certain altitude. When i type

if alt:radar = 15000 {

        stage.

        }

It does nothing when it crosses that altitude. Also, it doesn't recognize.

if 14500 < alt:radar < 15000 {

        stage.

        }

If I tell it to stage when it is below a certain altitude, it goes through all of the stages. How can I make it stage once at a certain altitude?

Edited by zeta function

Share this post


Link to post
Share on other sites
1 hour ago, zeta function said:

I am new to this mod, and i am trying to make it so that my craft stages once at a certain altitude. When i type

if alt:radar = 15000 {

        stage.

        }

It does nothing when it crosses that altitude. Also, it doesn't recognize.

if 14500 < alt:radar < 15000 {

        stage.

        }

If I tell it to stage when it is below a certain altitude, it goes through all of the stages. How can I make it stage once at a certain altitude?

dont use =

and dont use alt:radar over 5000 its buged

use if altitude>15000 stage

or 

when altitude > 15000 stage.

AFAIK X<Y<Z dos not work use X<Y and Y<Z

Share this post


Link to post
Share on other sites
3 hours ago, danielboro said:

when altitude > 15000 then stage.

triggers need a then statement. it's also good to know the difference between a trigger and a conditional statement, make sure you read the docs @zeta function

3 hours ago, danielboro said:

dont use =

because if you try to match a rapidly-changing value to a fixed value then you can miss it if the execution update takes too long and the altitude goes from 14999.84984861651 to 15000.000451464 from one tick to the next

Edited by Drew Kerman

Share this post


Link to post
Share on other sites
On 1/13/2018 at 4:05 PM, Drew Kerman said:

because if you try to match a rapidly-changing value to a fixed value then you can miss it if the execution update takes too long and the altitude goes from 14999.84984861651 to 15000.000451464 from one tick to the next

That's a statement that really shouldn't even include the qualifying "if".  It's so *drastically unlikely* to land on exactly 15000 at the very moment you take the measurement that you should write the script as if you expect it to be *literally impossible* to do so.  The chance of the "physics tick" landing on *exactly* the very moment the altitude is a specific hardcoded altitude, to within 64-bit floating point precision, is worse than trying to win first prize in the lottery.

 

Share this post


Link to post
Share on other sites
15 minutes ago, Steven Mading said:

That's a statement that really shouldn't even include the qualifying "if".  It's so *drastically unlikely* to land on exactly 15000 at the very moment you take the measurement that you should write the script as if you expect it to be *literally impossible* to do so.  The chance of the "physics tick" landing on *exactly* the very moment the altitude is a specific hardcoded altitude, to within 64-bit floating point precision, is worse than trying to win first prize in the lottery.

a worthy clarification. I didn't intend to say that you could still try it but I guess I did leave it open to such interpretation

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now