From 3570d5a922fc0b16300122d86b9746ebb1859adc Mon Sep 17 00:00:00 2001 From: Petruchio96 <44350446+Petruchio96@users.noreply.github.com> Date: Sun, 6 Jan 2019 08:37:15 -0600 Subject: [PATCH] Added functionality to ClearAllScience and updated Readme Signed-off-by: Petruchio96 <44350446+Petruchio96@users.noreply.github.com> --- README.md | 2 +- RunScience.ks | 14 ++++++++++++++ Standard_Lib.ks | 20 +++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d6f5bb..a4df20f 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ _**Optional Parameters:** None_ ### Function ClearAllScience() -**Description:** Resets all science experiments and crew reports. Science is lost on the science parts (experiements)when this function is run. This is useful when you've already collected all the science in the Experiment Storage Unit, and there are duplicate results that remain still on the science part(s). Running this fuction WILL NOT erase science in the Experiment Storage Unit - just on the experiements themselves. +**Description:** Resets all science experiments and crew reports. Science is lost on the science parts (experiements)when this function is run. Goo Canisters and Science Bays are reset, so they can be run again. This is useful when you've already collected all the science in the Experiment Storage Unit, and there are duplicate results that still remain on the science part(s). Running this fuction WILL NOT erase science in the Experiment Storage Unit - just on the experiements themselves. **Required Parameters:** None diff --git a/RunScience.ks b/RunScience.ks index 6b02a8f..30bbf59 100644 --- a/RunScience.ks +++ b/RunScience.ks @@ -1,3 +1,16 @@ +//This script is used to make it easier to quickly run science experiments and crew reports,store the +//science in an "Experiment Storage Unit" (ESU) and reset the experiements. Clearing all science is +//useful if you have already run the experiment and have stored the science in the ESU. "Collecting +//all science" will not store duplicate science data, and for Science Bays and Goo Canisters it will +//reset them so they can be run again. It will delete science data on experiments that can be +//repeatedly run, like thermometers. This allows you to repeatedly press 1-2-3 to quickly run all +//science experiments and gather all the data. I use this script while descending through an +//atmosphere so I can quickly get all the sceince at different altitudes and bioms. I don't have to +//click on each part or check to see if I've already got the data before running a goo or science bay. + +//Requirements - must have "Standard_Lib.ks" file in the same directory +// - Must have a Experiment Storage Unit part (ESU or "Science Box") on the ship + run Standard_Lib.ks. declare sensorlist to GetSensorList(). @@ -32,6 +45,7 @@ until Done { ResetScreen(). print ("Reset " + ClearAllScience(sensorlist) + " experiments") at(0,7). +//Any key, not just "4" will end the program } else { set Done to True. } diff --git a/Standard_Lib.ks b/Standard_Lib.ks index fbb8dda..5e70775 100644 --- a/Standard_Lib.ks +++ b/Standard_Lib.ks @@ -167,6 +167,24 @@ Function ClearAllScience { //only proceed is the experiment doesn't already have data if Sensor:getmodule("ModuleScienceExperiment"):hasdata { + //If it the part is a science bay, we need to reset it. + //Deleting the data will not allow the experiement to be run again + if Sensor:NAME = ("science.module") { + if Sensor:getmodule("ModuleScienceExperiment"):hasevent("reset materials bay") { + Sensor:getmodule("ModuleScienceExperiment"):doevent("reset materials bay"). + set counter to counter + 1. + } + }. + + //If it the part is a goo canister, we need to reset it. + //Deleting the data will not allow the experiement to be run again + if Sensor:NAME = ("GooExperiment") { + if Sensor:getmodule("ModuleScienceExperiment"):hasevent("reset goo canister") { + Sensor:getmodule("ModuleScienceExperiment"):doevent("reset goo canister"). + set counter to counter + 1. + } + }. + if Sensor:getmodule("ModuleScienceExperiment"):hasaction("delete data"){ Sensor:getmodule("ModuleScienceExperiment"):doaction("delete data", true). set counter to counter + 1. @@ -177,7 +195,7 @@ Function ClearAllScience { set counter to counter + 1. }. } - } + }. Return counter. }.