Jump to content

How To Identify a Science Definition from a Science Experiment Module


Recommended Posts

Task:

I'm making an external application that edits a save file and fills a specified vessel's science experiments/containers with science data. IE: Land a rover with various science experiments on Minmus, save, close, run my application, select my save file, specify my rover, and select all science experiments on the rover and select all biomes on Minmus, apply, close, run KSP, load, "fly" the rover, and I should have all selected experiments with science data for all selected biomes of Minmus.

Issue:

Based on the "PART" and "MODULE" data on a "VESSEL", I can't identify the associated "EXPERIMENT_DEFINITION" in ScienceDefs.cfg. I can do this only if a "MODULE" with a "name" of "ModuleScienceExperiment" already has "ScienceData", in which case I can parse the "subjectID" field and compare part of it to the "id" of an "EXPERIMENT_DEFINITION". This is less than ideal, however.

Relevant Excerpts:

ScienceDefs.cfg:

EXPERIMENT_DEFINITION
{
id = temperatureScan
title = Temperature Scan
}

persistent.sfs with a launched vessel equipped with a thermometer containing science data:

PART
{
name = sensorThermometer
rTrf = sensorThermometer
MODULE
{
name = ModuleScienceExperiment
ScienceData
{
subjectID = temperatureScan@KerbinSrfLandedLaunchPad
title = Temperature Scan from LaunchPad
}
}
}

Link to comment
Share on other sites

PART
{
[B]name = sensorThermometer[/B]
rTrf = sensorThermometer
MODULE
{
name = ModuleScienceExperiment
ScienceData
{
subjectID = temperatureScan@KerbinSrfLandedLaunchPad
title = Temperature Scan from LaunchPad
}
}
}

You will need to locate the part with the given name, in this case sensorThermometer. It will have a ModuleScienceExperiment with an experimentID.

MODULE
{
name = ModuleScienceExperiment

[B]experimentID = temperatureScan[/B]

experimentActionName = Log Temperature
resetActionName = Delete Data
[snip]

You can then find the experiment in ScienceDefs with the given ID

EXPERIMENT_DEFINITION
{
[B]id = temperatureScan[/B]
title = Temperature Scan
}

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...