Stage¶
Contents
Staging Example¶
A very simple auto-stager using
:READYLIST ENGINES IN elist. UNTIL false { PRINT "Stage: " + STAGE:NUMBER AT (0,0). FOR e IN elist { IF e:FLAMEOUT { STAGE. PRINT "STAGING!" AT (0,0). UNTIL STAGE:READY { WAIT 0. } LIST ENGINES IN elist. CLEARSCREEN. BREAK. } } }
Stage Function¶
-
Stage¶ Return: None Activates the next stage if the cpu vessel is the active vessel. This will trigger engines, decouplers, and any other parts that would normally be triggered by manually staging. The default equivalent key binding is the space bar. As with other parameter-less functions, both
STAGE.andSTAGE().are acceptable ways to call the function.Note
Changed in version 1.0.1: The stage function will automatically pause execution until the next tick. This is because some of the results of the staging event take effect immediately, while others do not update until the next time that physics are calculated. Calling
STAGE.is essentially equivalent to:STAGE. WAIT 0.
Warning
Calling the
Stagefunction on a vessel other than the active vessel will throw an exception.
Stage Structure¶
-
structure
Stage¶ Members¶ Suffix Type (units) Access Description READYBooleanGet only Is the craft ready to activate the next stage. NUMBERScalarGet only The current stage number for the craft RESOURCESListGet only the ListofAggregateResourcein the current stageRESOURCESLEXLexiconGet only the Lexiconof nameStringkeyedAggregateResourcevalues in the current stage
-
Stage:
READY¶ Access: Get only Type: BooleanKerbal Space Program enforces a small delay between staging commands, this is to allow the last staging command to complete. This bool value will let you know if kOS can activate the next stage.
-
Stage:
NUMBER¶ Access: Get only Type: ScalarEvery craft has a current stage, and that stage is represented by a number, this is it!
-
Stage:
Resources¶ Access: Get Type: ListThis is a collection of the available
AggregateResourcefor the current stage.
-
Stage:
Resourceslex¶ Access: Get Type: LexiconThis is a dictionary style collection of the available
Resourcefor the current stage. TheStringkey in the lexicon will match the name suffix on theAggregateResource. This suffix walks the parts list entirely on every call, so it is recommended that you cache the value if it will be reference repeatedly.