Skip to content

Commit

Permalink
Added functionality to ClearAllScience and updated Readme
Browse files Browse the repository at this point in the history
Signed-off-by: Petruchio96 <44350446+Petruchio96@users.noreply.github.com>
  • Loading branch information
Petruchio96 committed Jan 6, 2019
1 parent 9c7e7be commit 3570d5a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions RunScience.ks
Original file line number Diff line number Diff line change
@@ -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().
Expand Down Expand Up @@ -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.
}
Expand Down
20 changes: 19 additions & 1 deletion Standard_Lib.ks
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -177,7 +195,7 @@ Function ClearAllScience {
set counter to counter + 1.
}.
}
}
}.
Return counter.
}.

Expand Down

0 comments on commit 3570d5a

Please sign in to comment.