I'm just doing testing to see the behavior of the methods when various inputs are supplied.Regarding the truncation of floats: This is something I've already noticed. This also has nothing to do with the changes in Interpreter.dll, this happens with the direct C++ calls as well.
This bug might have been introduced by me lately but I have to investigate in that. It seems like the default precision has somehow dropped to 3 instead of the expected 6.
This looks like a unexpected change in the stream-based I/O library. I will fix that whenever I find the time.
Inputs as formatted in the script, all types verified:
VAL_STR = "foo" --string
VAL_INT = 42 --number
VAL_FLT = 3.141592 --number
VAL_VEC = {x=1.20, y=-3.40, z=5.60} --table (Orbiter vector)
oapi.writescenario_string
Proper use works:
- oapi.writescenario_string(scn, "VAL_STR", VAL_STR) writes VAL_STR foo
- oapi.writescenario_string(scn, "VAL_FLT", VAL_FLT) writes VAL_FLT 3.141592
- oapi.writescenario_string(scn, "VAL_INT", VAL_INT) writes VAL_FLT 42
- oapi.writescenario_string(scn, "VAL_VEC", VAL_VEC) writes nothing.
Proper use works:
- oapi.writescenario_int(scn, "VAL_INT", VAL_INT) writes VAL_INT 42
- oapi.writescenario_int(scn, "VAL_FLT", VAL_FLT) writes VAL_FLT 3
- oapi.writescenario_int (scn, "VAL_STR", VAL_STR) writes nothing
- oapi.writescenario_int (scn, "VAL_VEC", VAL_VEC) writes nothing
Proper use works, but truncates output:
- oapi.writescenario_float (scn, "VAL_FLT", VAL_FLT) writes VAL_FLT 3.14
- oapi.writescenario_float (scn, "VAL_INT", VAL_INT) writes VAL_INT 42.00
- oapi.writescenario_float (scn, "VAL_STR", VAL_STR) writes nothing
- oapi.writescenario_float (scn, "VAL_VEC", VAL_VEC) writes nothing
Proper use works...:
- oapi.writescenario_vec (scn, "VAL_VEC", VAL_VEC) writes VAL_VEC 1.20 -3.40 5.60
VAL_VEC = {x=1.205730, y=-3.406839, z=5.600375}
- oapi.writescenario_vec (scn, "VAL_VEC", VAL_VEC) writes VAL_VEC 1.21 -3.41 5.60
VAL_VEC = {x=1.205730e-5, y=-3.406839e4, z=5.600375e-2}
- oapi.writescenario_vec (scn, "VAL_VEC", VAL_VEC) VAL_VEC 0.00 -34068.39 0.06
- oapi.writescenario_vec (scn, "VAL_INT", VAL_INT) writes nothing
- oapi.writescenario_vec (scn, "VAL_FLT", VAL_FLT) writes nothing
- oapi.writescenario_vec (scn, "VAL_STR", VAL_STR) writes nothing