Jump to content

kos altitude trigger question


zeta function

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
Link to comment
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

Link to comment
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
Link to comment
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.

 

Link to comment
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

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...