kOS Print Pitch of Heading?
I'm pretty sure you simply have a syntax error. A direction like your steer
is a structure, not a function. To access its pitch
property, you need to write steer:pitch
, not steer(pitch)
.
Also note that, as far as I can tell, the name steer
has no special significance in kOS; it's just an arbitrary variable name. There is a special bound variable named steering
(not steer
) that is used for "cooked" flight control with the command:
lock steering to <expression>
where <expression>
is any vector or direction. However, it seems that quite a few kOS scripts will first assign the desired direction to a normal user variable (which might be named e.g. steer
) and then lock steering
to that variable.
I'm not 100% sure why they do that, but I suspect it may be a performance optimization: when you lock
a variable to an expression, kOS will recalculate the value of that expression every time the value of the variable is read. And kOS internally reads the value of steering
many times every second. Thus, if you only want to lock the steering to a constant direction, it's probably faster to first calculate that direction and assign it to a normal variable, and then lock steering
to that variable.
Anyway, the point of all this is that a command like print steer:pitch
will only print the pitch component of whatever direction you've assigned to the variable steer
. This may or may not actually have anything to do with the pitch that kOS is currently trying to steer your ship towards; that depends on whether you've locked steering
to steer
or not.