![]() You have moved 0 meters.īut if you run that on kOS's fake computer in a game engine like Unity where time moves in discrete lurching chunks and kOS is executing several instructions per chunk, it would look something more like this: You have moved 0 meters. If you ran something like that on a real-world computer on a car in motion rather than something simulated in a game engine, it might output something like this, showing a small movement for each loop iteration. Print "You have moved " + delta_pos:mag + " meters.". Local delta_pos is ship:position - prev_pos. ![]() So imagine a loop that wants to measure how far you've moved per loop iteration, like so: local prev_pos is ship:position. In kOS, because it's in a simulated game engine like Unity, it moves in discrete chunks. In the real world time keeps on slipping, slipping, slipping - into the future. to mean "at least some time passes" than if it had said 0 which a newbie might expect to mean the wait has literally no effect.Īs to the why of it: kOS differs from a real computer in an important way here. at that early stage of learning kOS since a newbie would at least understand 0.001. I thought it might be clearer to use wait 0.001. But at that particular place in the documentation, I was aware that a user would likely still be very new at kOS if they're still learning the keywords for flow control like if, until, etc. since all wait commands always have to wait at least one minimum tick of physics time, and the physics simulation in KSP is coarse-grain enough that 0.001 will round up to the smallest possible time, just like 0 will. Technically speaking the instructions could have said wait 0. I want to drill down a bit more into your question #3 about wait. He frequently corrects *me*, and I develop the thing.) (He's not a kOS dev, but he's probably the most expert user at how kOS works. #MOMENT LIST TIMESLICE TIL NEXT DAY JS CODE#What does the kerboscript language get compiled into? does it get compiled directly into machine code or is there an intermediate language as it happens in python or java? You can that I have written "wait 0.001." in every until loop, the kOS docs said to do that, but I don't understand why My speed variable get's calculated every time the until loop loops, but the value of the speed variable is 23 m/s less than the actual speed of the craft(that's why there's a "-23.5") why is this happening? what are some tips that you can give me to do that?Īnd I have some additional questions about my script and about kOS itself: And take the rocket into the orbit with the periapsis and apoapsis that you enter. How do I improve my script? Like what are the changes that I can make to make it better? And my next goal in kOS is to make a script that can take in necessary details about the rocket, like TWR, dry mass, wet mass, thrust, etc. I know the basics of how code works in general. I'm a newbie at kOS but not a beginner to programming because I know some python and basic javascript and basic c# and very little c++. I started messing around in kOS about 3 days ago and I made this script to take that particular rocket to a low kerbin orbit. Print "obrit reached, jettisoning payload in 3 seconds". If eta:apoapsis 6) and not (eta:apoapsis > 360) Set speed to sqrt(((ship:groundspeed + 174.53) ^ 2) + (ship:verticalspeed ^ 2)). ![]() Wait until eta:apoapsis orbital_speed - 23.5 I wrote some basic code to get this rocket into orbit and it works fine ![]() This rocket's payload is that ore tank filled with ore ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |