ScienceExperimentModule¶
The type of structures returned by kOS when querying a module that contains a science experiment.
Some of the science-related tasks are normally not available to kOS scripts. It is for example possible to deploy a science experiment:
SET P TO SHIP:PARTSNAMED("GooExperiment")[1].
SET M TO P:GETMODULE("ModuleScienceExperiment").
M:DOEVENT("observe mystery goo").
Hovewer, this results in a dialog being shown to the user. Only from that dialog it is possible
to reset the experiment or transmit the experiment results back to Kerbin.
ScienceExperimentModule
structure introduces a few suffixes that allow the player
to perform all science-related tasks without any manual intervention:
SET P TO SHIP:PARTSNAMED("GooExperiment")[0].
SET M TO P:GETMODULE("ModuleScienceExperiment").
M:DEPLOY.
WAIT UNTIL M:HASDATA.
M:TRANSMIT.
Please note the use of WAIT UNTIL M:HASDATA
.
This structure should work well with stock science experiments. Mods that introduce their own science parts might not be compatible with it. One notable example is SCANsat. Even though SCANsat parts look and behave very similarly to stock science experiments under the hood they work very differently. Other mods can cause problems as well, please test them before use.
DMagic Orbital Science has dedicated support in kOS and should work properly.
- structure ScienceExperimentModule¶
Suffix
Type
Description
All suffixes of
PartModule
ScienceExperimentModule
objects are a type ofPartModule
Deploy and run the science experiment
Reset this experiment if possible
Transmit the scientific data back to Kerbin
Discard the data
Is this experiment inoperable
Can this experiment be run multiple times
Is this experiment deployed
Does the experiment have scientific data
List
ofScienceData
List of scientific data obtained by this experiment
Note
A ScienceExperimentModule
is a type of PartModule
, and therefore can use all the suffixes of PartModule
.
- ScienceExperimentModule:DEPLOY()¶
Call this method to deploy and run this science experiment. This method will fail if the experiment already contains scientific data or is inoperable.
- ScienceExperimentModule:RESET()¶
Call this method to reset this experiment. This method will fail if the experiment is inoperable.
- ScienceExperimentModule:TRANSMIT()¶
Call this method to transmit the results of the experiment back to Kerbin. This will render the experiment inoperable if it is not rerunnable. This method will fail if there is no data to send.
- ScienceExperimentModule:DUMP()¶
Call this method to discard the data obtained as a result of running this experiment.
- ScienceExperimentModule:INOPERABLE¶
- Access
Get only
- Type
True if this experiment is no longer operable.
- ScienceExperimentModule:RERUNNABLE¶
- Access
Get only
- Type
True if this experiment can be run multiple times.
- ScienceExperimentModule:HASDATA¶
- Access
Get only
- Type
True if this experiment has scientific data stored.
- ScienceExperimentModule:DATA¶
- Access
Get only
- Type
List
ofScienceData
List of scientific data obtained by this experiment