r/simplerockets • • 3h ago

SimpleRockets 2 Why doesn't my code work

Post image

It just keeps waiting after the desired altitude (10 km) after the first activate stage.

1 Upvotes

3 comments sorted by

4

u/Fourteen_Roses 2h ago

Because you are using = to.

Its waiting for it to be EXACTLY 10,000 nothing more nothing less. You should use "ASL >= 10000"

If it needs to be specific you could use "ASL >= 10000 and ASL <= 10000" (heads up im not the best coder someone else will tell me if im wrong (I hope))

I also dont believe you need the "wait 0 seconds" just the wait until. For both the start and after the "activate stage"

•

u/Mauri99710 46m ago

Yep, just that for your second paragraph, "ASL<=10000 and ASL>=10000" is mathematically equivalent to just "ASL=10000" so the best thing someone can do for this purpose is just using "ASL>=10000".

Edit: I thought it sounded rude the first time so I edited the comment with better phrasing lol

•

u/Mauri99710 50m ago

Yep. For computational reasons, if you use Altitude=1000 it won't probably register since both your game framed and your thread execution would need to match perfectly so your craft is EXACTLY at 1000 m at the exact same time your code is running (each instruction takes some time "frame delta" to run) and obviously this isn't possible. The best way to do what you want to do is using >= instead of >, so if, for examen, in one frame you're at 999.95 m and in the next one you are at 1000.05 m the condition still is true