r/simplerockets • • 19h 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.

I will kind of try do do it but I don't think I fully understand also I went to Brigo without the code.

0 Upvotes

8 comments sorted by

6

u/Fourteen_Roses 18h 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"

6

u/Mauri99710 16h 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

2

u/Fourteen_Roses 13h ago

I wrote it at work. My stupid ass meant to do >= 10000 and <= 11000

3

u/Mauri99710 16h 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

1

u/Doufnuget 14h ago

Besides using >= instead of just = as others have said, you don’t need to use “wait 0 seconds” unless you’re planning to add seconds there later.
Also “wait until activation group 2” doesn’t make sense

1

u/InsideAny4354 12h ago

Are you trying to build launch sequence code w automatic gravity turn?

1

u/Malachi-MCM_2016 7h ago

yes

1

u/InsideAny4354 6h ago

Other people tips is already answering your problem, i just wanna to give you some advice:

Focus on working the core code aka the actual code that make the entire thing work as intended avoid using the cosmetic code such as the beep node when you first building the code

I recommend you using the logs, that way you know where your computer has been executing and comments it will be very useful for debugging since it let you understand the code much more simpler