FANDOM


Explanations:Edit

written meaningexplanation
|
separates alternatives
<something>
inputs
without brackets! e.g.: SET <variable> TO|= <value> would mean:
SET X TO "What ever"
not :   SET <X> TO <"What ever">
[something]
optional attributes
All commands have to end with a .

Commands:Edit

Self explaining commands:Edit

Click to expand/shrink
•   BREAK
Breaks out of the current loop.[1]
Click to expand/shrink
•   CLEARSCREEN
Clears the screen of all text.[1]
Click to expand/shrink
•   REBOOT
Reboots the current kOS device.[1]
Click to expand/shrink
•   SHUTDOWN
Shuts the current kOS device down. (Stops using electricity)[1]
Click to expand/shrink
•   STAGE
Initiates a staging.[1]

Math Functions:Edit

Click to expand/shrink
•   SIN(<float>),COS(<float>),TAN(<float>)
Trigonometric functions
Click to expand/shrink
•   ARCSIN(<float>),ARCCOS(<float>),ARCTAN(<float>)
Inverse trigonometric functions
Click to expand/shrink
•   ARCTAN2(<float>)
ARCTAN with 2 arguments for quadrant calculations
Click to expand/shrink
•   ABS(<float>)
gives back the absolute value of the input. Converts negative values to positive values. E.g.: ABS(-145)=145

Execution Flow Control:Edit

Click to expand/shrink
•   {<set_of_commands>}
Executes the commands in the curly braces in order of appearance, but is considered a single command. Can be used with UNTIL and IF.[1]
Click to expand/shrink
•   IF <compare_expression>[<COMMANDS>]
If the expression is true, execute the statements in the curly braces, otherwise skip ahead to the end of the curly braces.
Click to expand/shrink
•   RUN <file>[(parameter_list)]
Load another program file, run it, and return to this point in this program when it's finished. Parameters can be passed to the program but all other variables besides the parameters are global and shared by all programs.
Click to expand/shrink
•   UNTIL <compare_expression_or_boolean>{ <commands> }
Execute the commands in the curly braces repeatedly in a loop, checking the compare expression before each time through. If the compare expression is false, the loop is executed. If the compare expression is true, the loop stops. If the expression is true the first time, the loop never runs at all.
Click to expand/shrink
•   WAIT <float:_time_in_seconds>
Pause execution of this script program until the specified number of seconds have passed in *simulation* time, not real-time.
Click to expand/shrink
•   WAIT UNTIL <compare_expression_or_boolean>
Pause execution of this script program until the compare expression becomes true.
Click to expand/shrink
•   WHEN <compare_expression> THEN <statement_or_block>
Sets up a trigger that later will interrupt whatever is happening and run the command or list of commands when the compare expression becomes true. Causes the computer to begin performing this check in the background while it continues with the rest of the script. Once the event triggers once, the trigger is removed.
Click to expand/shrink
•   ON <AGX|SAS|RCS|bool_var*|float_var*> [<DO SOMETHING.>]
Sets up a trigger that later will interrupt whatever is happening and run the command or list of commands when the boolean variable becomes true. Causes the computer to begin performing this check in the background while it continues with the rest of the script. Once the event triggers once, the trigger is removed. This is very similar to the WHEN..THEN command, but it only operates on boolean variables not entire boolean expressions. Warning: kOS 0.61 will get bricked with "ON STAGE"

Manipulating booleans:Edit

(Also works for any numerical variable. Turning a number "on" makes it a 1. Turning it "off" makes it a 0.)

Click to expand/shrink
•   <bool_var*|float_var*> ON|OFF
Turns the variable on or off, e.g. AG5 ON[1]
Click to expand/shrink
•   TOGGLE <any_boolean_variable>
If variable is on, turns it off. If variable is off, turns it on.

(Also see the ON command above, which operates on booleans but is a flow control command).

other:Edit

Click to expand/shrink
•   COPY <file> TO|FROM<volume>
Copies the file FROM or TO a location[1]
Click to expand/shrink
•   DECLARE <new_variable>
declares a new empty variable[1]
Click to expand/shrink
•   DECLARE PARAMETER <variable>[,<variable>[,...]]
declares one or more variables that are given from the outside as parameter
Click to expand/shrink
•   DELETE <file>[FROM <volume>]
Deletes file from specified volume[1]
Click to expand/shrink
•   EDIT <file>
Opens/creates the file for editing[1]
Click to expand/shrink
•   LIST VOLUMES|FILES|PARTS|RESOURCES|ENGINES|TARGETS|BODIES
Sorry, no one has written an explanation yet!
Click to expand/shrink
•   LOCK <variable> TO <expression>
Set a variable to be constantly re-updated in the background to match the expression. Whenever any change to the expression is made, the variable will change automatically to match.
Click to expand/shrink
•   UNLOCK <variable>
Remove a previously set auto-updating lock on a variable. The variable will retain whatever value it had when the UNLOCK command was run.
Click to expand/shrink
•   LOG <string_to_be_appended_to_the_file> TO <file>
Click to expand/shrink
•   PRINT <string> [AT(<integer_x*>,<integer_y*>)]
since 0.7 print at (x,y) now works with variables [1]
Click to expand/shrink
•   RENAME VOLUME|FILE <volume_or_file_name> TO <new_name>
Sorry, no one has written an explanation yet!
Click to expand/shrink
•   SET <variable>TO <value>
set <variable>= <value> accepts no whitespaces between the variable and the =
= removed in 0.7
Click to expand/shrink
•   SWITCH TO <volume_number_or_volume_name>
Changes which disk volume will be the default used on subsequent commands.

System Variables:Edit

Lockable variables:Edit

Only to be used with LOCK and UNLOCK. (Not with SET. They don't have the desired effect when used with SET.)
Locking STEERING to a Direction or Vector tells the KOS computer to rotate the vessel to point its "nose" at the direction it's set to. Which end of the vessel is the "nose" end depends on what control module or docking port has been selected as "control from here", just like with manual steering. How long it takes to accomplish this rotation depends on how much torque and RCS rotation the vessel has, just like with manual steering. However, the computer will not pause program execution to wait for this rotation to finish. It will continue on and execute the next statements while the computer starts rotating the vessel as a background task. STEERING can be locked to a Direction or to a Vector. Examples:
LOCK STEERING TO VELOCITY:ORBIT + V(0,10,0).
LOCK STEERING TO R(0,45,0).
While the steering is locked, attempts to turn the vessel by manual control don't work. You must UNLOCK STEERING before the manual control of the throttle will work. However, if the script program exits, the steering will unlock.
Locking THROTTLE to a floating point number within the range of 0.000 through 1.000 sets the vessels' throttle control to a value between 0% and 100% of maximum. (i.e. LOCK THROTTLE TO 0.25 will put the throttle at 25%). It is possible to get greater precision with this than is allowed with the manual controls (You can move the throttle by smaller increments than a single keypress of SHIFT or CTRL would do in manual control.)
While the throttle is locked, attempts to change the throttle by manual control don't work. You must UNLOCK THROTTLE before the manual control of the throttle will work. However, if the script program exits, the throttle will unlock.
  • WHEELSTEERING[1]
  • WHEELTHROTTLE[1]

Bindings:Edit

They can be triggered with ... ON | ... OFF | TOGGLE ...
Except TARGET which has to be used with SET ... TO ...
ABORT[1]AG<1-10>[1]BRAKES[1]GEAR[1]LIGHTS[1]RCS[1]SAS[1]TARGET[1]

System variables:Edit

ALTITUDE:
ALTITUDE[1]ALT:RADAR[1]ALT:APOAPSIS[1]ALT:PERIAPSIS[1]APOAPSIS[1]PERIAPSIS[1]
TIME:
ETA:APOAPSIS[1]ETA:PERIAPSIS[1]ETA:NODE[1]MISSIONTIME[1]SESSIONTIME[1]WARP[1]
Speed:
ANGULARMOMENTUM[1]ANGULARVEL[1]SURFACESPEED[1]VERTICALSPEED[1]VELOCITY[:SURFACE|ORBIT|SURFACEHEADING][1]
Steering:
<Direction>:PITCH|YAW|ROLL[1]FACING[1]GEOPOSITION[1]HEADING[1]LATITUDE[1]LONGITUDE[1]
MAG:NODE[1]NORTH[1]PROGRADE[1]RETROGRADE[1]UP[1]NODE[1]
other:
AV[1]BODY[1]MASS[1]MAXTHRUST[1]STATUS[1]STAGE[:<ressource>][1]
TARGET[:DISTANCE|DIRECTION|BEARING|HEADING][1]VESSELNAME[1]
<<name_of_any_resource>>
Note: This last one collides with my explanation style.
That means the bold brackets have to be written.
E.g.: <liquidfuel> is a valid one. while liquidfuel is not.

Other Informations:Edit

To be Placed on this site:Edit

  • Time[:clock|:calendar|:day|:year|:hour|:minute|:second]
  • add Node(<time>,<delta_v_x>,<delta_v_y>,<delta_v_z>)
set to Node(). add <var>.
<var>[:deltav|:deltav:mag]
  • nextnode[:eta]
  • encounter[:peripapsis]
  • remove node|nextnode

Upcomming features:Edit

  • FLOOR(),CEILING(),ROUND(), SQRT()
  • T() Value = new TimeSpan(parameters[0]);
  • CALL <???>[1]

Not working, without function or only partly implemented:Edit

  • TERMINATOR <one character>[1]
  • TEST[1]
    does nothing than printing Test!

Notes:Edit

*= Additional mentioned in the source code, but functionality hasn't been tested yet.

Wikiupdate:Edit

In here is the data for the next Update of this wiki page:

Everything in here is a very raw extract of the current (after 0.9.2 and before 0.9.3+) source code. This is what has to be included in here. To be on the save side I have here (at least I tried to) everything not only what has changed or is missing. Anyway here is the very raw list:
THROTTLE", "throttle", cpu, manager));
            controls.Add(new LockableControl("STEERING", "steering", cpu, manager));

            controls.Add(new LockableControl("WHEELSTEERING", "wheelsteering", cpu, manager));
            controls.Add(new LockableControl("WHEELTHROTTLE
			
			
           manager.AddSetter("SAS", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.SAS, (bool)val); });
            manager.AddSetter("GEAR", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Gear, (bool)val); });
            manager.AddSetter("LEGS", delegate(CPU cpu, object val) {  VesselUtils.LandingLegsCtrl(cpu.Vessel, (bool)val); });
            manager.AddSetter("CHUTES", delegate(CPU cpu, object val) {  VesselUtils.DeployParachutes(cpu.Vessel, (bool)val); });
            manager.AddSetter("LIGHTS", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Light, (bool)val); });
            manager.AddSetter("PANELS", delegate(CPU cpu, object val) {  VesselUtils.SolarPanelCtrl(cpu.Vessel, (bool)val); });
            manager.AddSetter("BRAKES", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, (bool)val); });
            manager.AddSetter("RCS", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.RCS, (bool)val); });
            manager.AddSetter("ABORT", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Abort, (bool)val); });
            manager.AddSetter("AG1", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom01, (bool)val); });
            manager.AddSetter("AG2", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom02, (bool)val); });
            manager.AddSetter("AG3", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom03, (bool)val); });
            manager.AddSetter("AG4", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom04, (bool)val); });
            manager.AddSetter("AG5", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom05, (bool)val); });
            manager.AddSetter("AG6", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom06, (bool)val); });
            manager.AddSetter("AG7", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom07, (bool)val); });
            manager.AddSetter("AG8", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom08, (bool)val); });
            manager.AddSetter("AG9", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom09, (bool)val); });
            manager.AddSetter("AG10", delegate(CPU cpu, object val) { cpu.Vessel.ActionGroups.SetGroup(KSPActionGroup.Custom10, (bool)val); });

			
            manager.AddGetter("TARGET", delegate(CPU cpu) 

			
            manager.AddGetter("ALT:RADAR",      delegate(CPU cpu) { return cpu.Vessel.heightFromTerrain > 0 ? Mathf.Min(cpu.Vessel.heightFromTerrain, (float)cpu.Vessel.altitude) : (float)cpu.Vessel.altitude; });
            manager.AddGetter("ALT:APOAPSIS",   delegate(CPU cpu) { return cpu.Vessel.orbit.ApA; });
            manager.AddGetter("ALT:PERIAPSIS",  delegate(CPU cpu) { return cpu.Vessel.orbit.PeA; });
            manager.AddGetter("ETA:APOAPSIS",   delegate(CPU cpu) { return cpu.Vessel.orbit.timeToAp; });
            manager.AddGetter("ETA:PERIAPSIS",  delegate(CPU cpu) { return cpu.Vessel.orbit.timeToPe; });

            manager.AddGetter("MISSIONTIME",    delegate(CPU cpu) { return cpu.Vessel.missionTime; });
            manager.AddGetter("TIME",           delegate(CPU cpu) { return new kOS.TimeSpan(Planetarium.GetUniversalTime()); });

            manager.AddGetter("STATUS",         delegate(CPU cpu) { return cpu.Vessel.situation.ToString().Replace("_", " "); });
            manager.AddGetter("COMMRANGE",      delegate(CPU cpu) { return VesselUtils.GetCommRange(cpu.Vessel); });
            manager.AddGetter("INCOMMRANGE",    delegate(CPU cpu) { return Convert.ToDouble(CheckCommRange(cpu.Vessel)); });

            manager.AddGetter("AV", delegate(CPU cpu) { return cpu.Vessel.transform.InverseTransformDirection(cpu.Vessel.rigidbody.angularVelocity); });
            manager.AddGetter("STAGE", delegate(CPU cpu) { return new StageValues(cpu.Vessel); });

            manager.AddGetter("ENCOUNTER",      delegate(CPU cpu) { return VesselUtils.TryGetEncounter(cpu.Vessel); });

            manager.AddGetter("NEXTNODE",       delegate(CPU cpu)
  
            manager.AddGetter("SHIP", delegate(CPU cpu) { return new VesselTarget(cpu.Vessel, cpu); });

            // These are now considered shortcuts to SHIP:suffix
            foreach (String scName in VesselTarget.ShortCuttableShipSuffixes)
            {
                manager.AddGetter(scName, delegate(CPU cpu) { return new VesselTarget(cpu.Vessel, cpu).GetSuffix(scName); });
            }

            manager.AddSetter("VESSELNAME", delegate(CPU cpu, object value) { cpu.Vessel.vesselName = value.ToString(); });
			
            manager.AddGetter("SESSIONTIME", delegate(CPU cpu) { return cpu.SessionTime; });
            manager.AddGetter("VERSION", delegate(CPU cpu) { return Core.VersionInfo; });

            manager.AddGetter("TEST:RADAR", delegate(CPU cpu)
			
            manager.AddGetter("WARP", delegate(CPU cpu) { return TimeWarp.fetch.current_rate_index; });

        public override object GetSuffix(string suffixName)
        {
            if (target == null) throw new kOSException("BODY structure appears to be empty!");

            if (suffixName == "NAME") return target.name;
            if (suffixName == "DESCRIPTION") return target.bodyDescription;
            if (suffixName == "MASS") return target.Mass;
            if (suffixName == "POSITION") return new Vector(target.position);
            if (suffixName == "ALTITUDE") return target.orbit.altitude;
            if (suffixName == "APOAPSIS") return target.orbit.ApA;
            if (suffixName == "PERIAPSIS") return target.orbit.PeA;
            if (suffixName == "VELOCITY") return new Vector(target.orbit.GetVel());
            if (suffixName == "DISTANCE") return (float)GetDistance();
            if (suffixName == "BODY") return new BodyTarget(target.orbit.referenceBody, context);

CLEARSCREEN
SHUTDOWN
REBOOT

PRINT * AT_(2)

PRINT *

TEST *

DECLARE %

DECLARE PARAMETERS? *

CommandAttribute("SET ~ TO *")

CommandAttribute("TOGGLE %")

CommandAttribute("% ON")

CommandAttribute("% OFF")

CommandAttribute("CALL *")

CommandAttribute("EDIT &")

CommandAttribute(@"^RUN ([a-zA-Z0-9\-_]+?)( ?\((.*?)\))?$")

CommandAttribute("SWITCH TO ^")

CommandAttribute("RENAME[VOLUME,FILE]? ^ TO &")

CommandAttribute("LOG * TO &")

CommandAttribute("COPY &[TO,FROM][VOLUME]? ^")

CommandAttribute("DELETE &[FROM,FROM VOLUME]?[:^]?")

CommandAttribute("LIST[VOLUMES,FILES]?")

CommandAttribute("^{([\\S\\s]*)}$")

CommandAttribute("IF ~_{}")

CommandAttribute("UNTIL ~_{}")

CommandAttribute("BREAK")

CommandAttribute("WAIT[UNTIL]? *")

CommandAttribute("ON % *")

CommandAttribute("LOCK % TO *")

CommandAttribute("UNLOCK %")

CommandAttribute("WHEN ~ THEN *")

CommandAttribute("STAGE")

CommandAttribute("ADD *") //(nodes)

CommandAttribute("REMOVE *") //nodes

CommandAttribute(@"^LIST (PARTS|RESOURCES|ENGINES|TARGETS|BODIES|SENSORS)$")

        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "PITCH") return euler.x;
            if (suffixName == "YAW") return euler.y;
            if (suffixName == "ROLL") return euler.z;
            if (suffixName == "VECTOR") return new kOS.Vector(vector);

            return "R(" + Math.Round(euler.x, 3) + "," + Math.Round(euler.y, 3) + "," + Math.Round(euler.z, 3) + ")";

                if (c1.Opr == "==" || c1.Opr == "=") resultValue = AttemptEq(c1.Value, c2.Value);
                else if (c1.Opr == "!=") resultValue = AttemptNotEq(c1.Value, c2.Value);
                else if (c1.Opr == "<") resultValue = AttemptLT(c1.Value, c2.Value);
                else if (c1.Opr == ">") resultValue = AttemptGT(c1.Value, c2.Value);
                else if (c1.Opr == "<=") resultValue = AttemptLTE(c1.Value, c2.Value);
                else if (c1.Opr == ">=") resultValue = AttemptGTE(c1.Value, c2.Value);

				
				
            if (name == "SIN") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Sin(dp[0] * (Math.PI / 180)); }
            if (name == "COS") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Cos(dp[0] * (Math.PI / 180)); }
            if (name == "TAN") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Tan(dp[0] * (Math.PI / 180)); }
            if (name == "ARCSIN") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Asin(dp[0]) * (180 / Math.PI); }
            if (name == "ARCCOS") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Acos(dp[0]) * (180 / Math.PI); }
            if (name == "ARCTAN") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Atan(dp[0]) * (180 / Math.PI); }
            if (name == "ARCTAN2") { double[] dp = GetParamsAsT<double>(p, 2); return Math.Atan2(dp[0], dp[1]) * (180 / Math.PI); }

            if (name == "ABS") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Abs(dp[0]); }
            if (name == "MOD") { double[] dp = GetParamsAsT<double>(p, 2); return dp[0] % dp[1]; }
            if (name == "FLOOR") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Floor(dp[0]); }
            if (name == "CEILING") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Ceiling(dp[0]); }
            if (name == "SQRT") { double[] dp = GetParamsAsT<double>(p, 1); return Math.Sqrt(dp[0]); }

            if (name == "ROUND")

			
            if (name == "NODE") { double[] dp = GetParamsAsT<double>(p, 4); return new Node(dp[0], dp[1], dp[2], dp[3]); }
            if (name == "V") { double[] dp = GetParamsAsT<double>(p, 3); return new Vector(dp[0], dp[1], dp[2]); }
            if (name == "R") { double[] dp = GetParamsAsT<double>(p, 3); return new Direction(new Vector3d(dp[0], dp[1], dp[2]), true); }
            if (name == "Q") { double[] dp = GetParamsAsT<double>(p, 4); return new Direction(new UnityEngine.Quaternion((float)dp[0], (float)dp[1], (float)dp[2], (float)dp[3])); }
            if (name == "T") { double[] dp = GetParamsAsT<double>(p, 1); return new TimeSpan(dp[0]); }
            if (name == "LATLNG") { double[] dp = GetParamsAsT<double>(p, 2); return new GeoCoordinates(executionContext.Vessel, dp[0], dp[1]); }
            if (name == "VESSEL") { String[] sp = GetParamsAsT<String>(p, 1); return new VesselTarget(VesselUtils.GetVesselByName(sp[0], executionContext.Vessel), executionContext); }
            if (name == "BODY") { String[] sp = GetParamsAsT<String>(p, 1); return new BodyTarget(sp[0], executionContext); }

            if (name == "HEADING")
            {
                int pCount = p.Count();
                if (pCount < 2 || pCount > 3) throw new kOSException("Wrong number of arguments supplied, expected 2 or 3", executionContext);
            mathSymbols.AddRange(new string[] { "+", "-", "*", "/", "^" });

            comparisonSymbols = new List<string>();
            comparisonSymbols.AddRange(new string[] { "<=", ">=", "!=", "==", "=", "<", ">" });

            booleanSymbols = new List<string>();
            booleanSymbols.AddRange(new string[] { " AND ", " OR " });

            parameterSeperatorSymbols = new List<string>();
            parameterSeperatorSymbols.AddRange(new string[] { "," });

            subaccessSymbols = new List<string>();
            subaccessSymbols.AddRange(new string[] { ":" });

            delimeterSymbols = new List<string>();
            delimeterSymbols.AddRange(new string[] { "(", ")", "\"" });

            if (suffixName == "LAT") return Lat;
            if (suffixName == "LNG") return Lng;
            if (suffixName == "DISTANCE") return DistanceFrom(Vessel);
            if (suffixName == "HEADING") return (double)GetHeadingFromVessel(Vessel);
            if (suffixName == "BEARING") return (double)GetBearing(Vessel);
            
            return base.GetSuffix(suffixName);
        }
        
        public override string ToString()
        {
            return "LATLNG(" + Lat + ", " + Lng + ")";


        public override object GetSuffix(string suffixName)
        {
            updateValues();
            
            if (suffixName == "BURNVECTOR") return GetBurnVector();
            else if (suffixName == "ETA") return UT - Planetarium.GetUniversalTime();
            else if (suffixName == "DELTAV") return GetBurnVector();
            else if (suffixName == "PROGRADE") return Pro;
            else if (suffixName == "RADIALOUT") return RadOut;
            else if (suffixName == "NORMAL") return Norm;
            else if (suffixName == "APOAPSIS")
            {
                if (nodeRef == null) throw new kOSException("Node must be added to flight plan first");
                return nodeRef.nextPatch.ApA;
            }
            else if (suffixName == "PERIAPSIS")
			
        public override string ToString()
        {
            return "NODE(" + UT + "," + RadOut + "," + Norm + "," + Pro + ")";
        }

		
        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "APOAPSIS") return orbitRef.ApA;
            else if (suffixName == "PERIAPSIS") return orbitRef.PeA;
            else if (suffixName == "BODY") return orbitRef.referenceBody.name;

	
        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "YEAR") return Year();
            if (suffixName == "DAY") return Day();
            if (suffixName == "HOUR") return span.Hours;
            if (suffixName == "MINUTE") return span.Minutes;
            if (suffixName == "SECOND") return span.Seconds;

            if (suffixName == "SECONDS") return span.TotalSeconds;

            if (suffixName == "CLOCK") return span.Hours + ":" + String.Format(span.Minutes.ToString("00") + ":" + String.Format(span.Seconds.ToString("00")));
            if (suffixName == "CALENDAR") return "Year " + Year() + ", day " + Day();

             if (other is TimeSpan && op == "+") return this + (TimeSpan)other;
            if (other is double && op == "+") return this + (double)other;
            if (other is double && op == "*") return this * (double)other; // Order would matter here if this were matrices

            if (!reverseOrder)
            {
                if (other is TimeSpan && op == "-") return this - (TimeSpan)other;
                if (other is TimeSpan && op == "/") return this / (TimeSpan)other;
                if (other is double && op == "-") return this - (double)other;
                if (other is double && op == "/") return this / (double)other;
                if (other is TimeSpan && op == ">") return this > (TimeSpan)other;
                if (other is TimeSpan && op == "<") return this < (TimeSpan)other;
                if (other is TimeSpan && op == ">=") return this >= (TimeSpan)other;
                if (other is TimeSpan && op == "<=") return this <= (TimeSpan)other;
                if (other is double && op == ">") return this > (double)other;
                if (other is double && op == "<") return this < (double)other;
                if (other is double && op == ">=") return this >= (double)other;
                if (other is double && op == "<=") return this <= (double)other;
            }
            else
            {
                if (other is TimeSpan && op == "-") return (TimeSpan)other - this;
                if (other is TimeSpan && op == "/") return (TimeSpan)other / this;
                if (other is double && op == "-") return (double)other - this;
               if (other is double && op == "/") return (double)other / this; // Can't imagine why the heck you'd want to do this but here it is
               if (other is TimeSpan && op == ">") return this < (TimeSpan)other;
               if (other is TimeSpan && op == "<") return this > (TimeSpan)other;
               if (other is TimeSpan && op == ">=") return (TimeSpan)other >= this;
               if (other is TimeSpan && op == "<=") return (TimeSpan)other <= this;
               if (other is double && op == ">") return (double)other > this;
               if (other is double && op == "<") return (double)other < this;
               if (other is double && op == ">=") return (double)other >= this;
               if (other is double && op == "<=") return (double)other <= this;

			   
Vector:
        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "X") return x;
            if (suffixName == "Y") return y;
            if (suffixName == "Z") return z;
            if (suffixName == "MAG") return new Vector3d(x, y, z).magnitude;
            if (suffixName == "VEC") return new Vector(x, y, z);
            return "V(" + x + ", " + y + ", " + z + ")";

			
			
			
			
                            switch (module.Fields.GetValue("sensorType").ToString())
                            {
                                case "ACC":
                                    acceleration = new Vector(FlightGlobals.getGeeForceAtPosition(part.transform.position) - target.acceleration);
                                    break;
                                case "PRES":
                                    pressure = (Single)FlightGlobals.getStaticPressure();
                                    break;
                                case "TEMP":
                                    temperature = part.temperature;
                                    break;
                                case "GRAV":
                                    geeForce = new Vector(FlightGlobals.getGeeForceAtPosition(part.transform.position));
                                    break;
     
	 
        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "ACC") return acceleration;
            if (suffixName == "PRES") return pressure;
            if (suffixName == "TEMP") return temperature;
            if (suffixName == "GRAV") return geeForce;
            if (suffixName == "LIGHT") return KerbolExposure;

			
                "HEADING", "PROGRADE", "RETROGRADE", "FACING", "MAXTHRUST", "VELOCITY", "GEOPOSITION", "LATITUDE", "LONGITUDE", 
                "UP", "NORTH", "BODY", "ANGULARMOMENTUM", "ANGULARVEL", "MASS", "VERTICALSPEED", "SURFACESPEED", "AIRSPEED", "VESSELNAME", 
                "ALTITUDE", "APOAPSIS", "PERIAPSIS", "SENSOR"
 
 
             if (suffixName == "DIRECTION")
            {
                var vector = (target.GetWorldPos3D() - context.Vessel.GetWorldPos3D());
                return new Direction(vector, false);
            }

            if (suffixName == "DISTANCE") return (float)GetDistance();
            if (suffixName == "BEARING") return VesselUtils.GetTargetBearing(context.Vessel, target);
            if (suffixName == "HEADING") return VesselUtils.GetTargetHeading(context.Vessel, target);
            if (suffixName == "PROGRADE") return GetPrograde();
            if (suffixName == "RETROGRADE") return GetRetrograde();
            if (suffixName == "MAXTHRUST") return VesselUtils.GetMaxThrust(target);
            if (suffixName == "VELOCITY") return new VesselVelocity(target);
            if (suffixName == "GEOPOSITION") return new GeoCoordinates(target);
            if (suffixName == "LATITUDE") return VesselUtils.GetVesselLattitude(target);
            if (suffixName == "LONGITUDE") return VesselUtils.GetVesselLongitude(target);
            if (suffixName == "FACING") return GetFacing();
            if (suffixName == "UP") return new Direction(target.upAxis, false);
            if (suffixName == "NORTH") return new Direction(VesselUtils.GetNorthVector(target), false);
            if (suffixName == "BODY") return target.mainBody.bodyName;
            if (suffixName == "ANGULARMOMENTUM") return  new Direction(target.angularMomentum, true);
            if (suffixName == "ANGULARVEL") return new Direction(target.angularVelocity, true);
            if (suffixName == "MASS") return  target.GetTotalMass();
            if (suffixName == "VERTICALSPEED") return  target.verticalSpeed;
            if (suffixName == "SURFACESPEED") return  target.horizontalSrfSpeed;
            if (suffixName == "AIRSPEED") return (target.orbit.GetVel() - FlightGlobals.currentMainBody.getRFrmVel(target.GetWorldPos3D())).magnitude; //the velocity of the vessel relative to the air);
            if (suffixName == "VESSELNAME") return  target.vesselName;
            if (suffixName == "ALTITUDE") return target.altitude;
            if (suffixName == "APOAPSIS") return  target.orbit.ApA;
            if (suffixName == "PERIAPSIS") return  target.orbit.PeA; 
            if (suffixName == "SENSOR") return new VesselSensors(target);
            if (suffixName == "TERMVELOCITY") return VesselUtils.GetTerminalVelocity(target);

	
	
        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "ORBIT") return orbitVelocity;
            if (suffixName == "SURFACE") return surfaceVelocity;

            // I created this one for debugging purposes only, at some point I'll make a function to transform vectors to headings in a more eloquent way
            if (suffixName == "SURFACEHEADING") return velocityHeading;
------------
Not included pulls (22.11.2013):
Unset // unset all

STAGE as actiongroup //on stage // stage on /off /toggle

inlight

Machnumber

eairspeed

Quicksave

LIST FILES ON

volume:selected and volume:freespace

Start a Discussion Discussions about List of all Commands

  • A better organization for the list of commands?

    3 messages
    • Ok, me again. :P This is a list of variable types and members my script compiled from the kOS source, just if anyone want to take a look at it...
    • Sorry, totally missed that discussion. Yeah, I was was aware that the organisation was not the best. And the list isn't complete, either....

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.