untoldwind / KontrolSystem2

Autopilot scripting system for KSP2
Other
54 stars 15 forks source link

ksp::telemetry::add_time_series() not working #97

Closed plonk-75 closed 1 year ago

plonk-75 commented 1 year ago

The example code from simple-example does not work.

Script to reproduce error:

use { Vessel } from ksp::vessel
use { add_time_series } from ksp::telemetry
use { cos_deg } from core::math

pub fn main_flight( vessel: Vessel) -> Result<Unit, string> = {
    let cos = add_time_series("Cos", 0, 0.1)
    for(i in 0..20000) {
        cos.add_data(i * 0.2, cos_deg(i / 20.0))
    }
}

Result:

>>>>> ERROR <<<<<<<<<

Module plonk::testgraphs terminated with:
Object reference not set to an instance of an object

Expected result: No error, working example

Reduced to the most simple form:

pub fn main_flight( vessel: ksp::vessel::Vessel) -> Result<Unit, string> = {
    let cos = ksp::telemetry::add_time_series("Cos", 0, 0.1)
}

Still responding with the same error message.

untoldwind commented 1 year ago

This must have happened during one of the refactoring/cleanup rounds ... totally avoidable. Lesson learned: Don't trust your IDE too much. Should work again in 0.4.2.3

plonk-75 commented 1 year ago

Fix confirmed!

EDIT2: removed additional comments, opened new issue #98 instead