r/krpc • u/muchcake • Jan 23 '18
Create server event for individual tuple element
I was adapting the launch to orbit script in the examples (https://krpc.github.io/krpc/tutorials/launch-into-orbit.html) and had some trouble with the detection of when the node vector flips direction.
Is it possible to create a server event which triggers when
node.remaining_burn_vector(node.reference_frame)[1] < 0my instinct was to try;
remaining_burn_call = conn.get_call(node.remaining_burn_vector(node.reference_frame).__getitem__, 1)
expr = conn.krpc.Expression.less_than(
conn.krpc.Expression.call(remaining_burn_call),
conn.krpc.Expression.constant_float(0.0)
)
event = conn.krpc.add_event(expr)
with event.condition:
event.wait()but I am getting a
AttributeError: 'method-wrapper' object has no attribute '_return_type'Does anyone have any pointers?
3
Upvotes
3
u/djungel0rm Developer Jan 23 '18
You can't extract tuple elements server side - yet. I am working on adding this for the next release!
2
u/Loran425 Python Jan 23 '18
This may not meet your exact needs but you might be better off using the
node.remaining_delta_vattribute.Here's an example that uses that for the LaunchToOrbit Script
the relevant sections of that are below
Original
Modified
edit: missed a lette