getblocksoftype double CruiseControlSpeed = 50; IMyTextPanel lcd; IMyTextPanel statusLCD; IMyTextPanel fancyLCD; int lightState = 0; double targetAccel = 0; bool prevState = false; bool done2 = false; bool CruiseControl = false; IMyShipController shipController = null; Color colorOff = new Color(0, 0, 0); getblocksoftype How to dowload it? getblocksoftype Color colorOn = new Color(255,255,255); Color colorRear = new Color(100,0,0,255); Color colorYel = new Color(175,175,100,255); public void Main(string argument) { if (argument == "+5" && CruiseControlSpeed <= 95) { CruiseControlSpeed = CruiseControlSpeed + 5; getblocksoftype How to dowload it? getblocksoftype } if (argument == "-5" && CruiseControlSpeed >= 15) { CruiseControlSpeed = CruiseControlSpeed - 5; } if (argument == "CC") { if (CruiseControl == false) getblocksoftype PasteShr getblocksoftype { CruiseControl = true; } else { CruiseControl = false; } } shipController = GridTerminalSystem?.GetBlockWithName("shipController") as IMyShipController; getblocksoftype How to get it for free? getblocksoftype if (shipController == null) //// error check { Echo("Aww shit! Aint no damn ship controllers yo!"); return; //stops running the code } var hdg = shipController.MoveIndicator; lcd = GridTerminalSystem.GetBlockWithName("Speed Out") as IMyTextPanel; getblocksoftype How to get it for free? getblocksoftype statusLCD = GridTerminalSystem.GetBlockWithName("Status LCD") as IMyTextPanel; lcd?.WritePublicText(""); //// added quesion marks var ToggledLights = GridTerminalSystem.GetBlockGroupWithName("LTOGGLE"); var Toggled = new List(); ToggledLights?.GetBlocksOfType(Toggled); var RearLights = GridTerminalSystem.GetBlockGroupWithName("REAR"); var RedLights = new List(); RearLights?.GetBlocksOfType(RedLights); getblocksoftype How to dowload it? getblocksoftype var YellowLights = GridTerminalSystem.GetBlockGroupWithName("YEL"); var YelLights = new List(); YellowLights?.GetBlocksOfType(YelLights); var BrekLights = GridTerminalSystem.GetBlockGroupWithName("BRK"); var BRKLights = new List(); BrekLights?.GetBlocksOfType(BRKLights); getblocksoftype PasteShr getblocksoftype ////Never differentiate variables by case. They should be descriptive //"wheels" should be something like "wheelGroup" //"Wheels" should then be named "wheels". Only methods start capital var wheelGroup = GridTerminalSystem.GetBlockGroupWithName("Wheels"); var wheels = new List(); wheelGroup?.GetBlocksOfType(wheels); var wheelStabilityGroup = GridTerminalSystem.GetBlockGroupWithName("WheelsExtend"); var wheelStabilizers = new List(); getblocksoftype How to get it? getblocksoftype wheelStabilityGroup?.GetBlocksOfType(wheelStabilizers); //// /* question mark is a null check Means the same as: if (wheelGroup != null) wheelGroup.GetBlocksOfType(wheels); */ getblocksoftype How to use it? getblocksoftype PrintSpeed(shipController.GetShipSpeed()); IMyReflectorLight spotlight = GridTerminalSystem.GetBlockWithName("Spotlight R") as IMyReflectorLight; if (spotlight.Enabled != prevState && spotlight != null) ////null check { lightState = lightState + 1; if (lightState > 2) { getblocksoftype How to dowload it? getblocksoftype lightState = 0; } prevState = spotlight.Enabled; } if (lightState == 0) { foreach (IMyInteriorLight light in Toggled) getblocksoftype How to get it? getblocksoftype light.SetValue("Color", colorOff); } foreach (IMyInteriorLight light in RedLights) { light.SetValue("Color", colorOff); } foreach (IMyInteriorLight light in YelLights) { getblocksoftype How to dowload it? getblocksoftype light.SetValue("Color", colorYel); } IMyReflectorLight spotlight2 = GridTerminalSystem.GetBlockWithName("Spotlight") as IMyReflectorLight; spotlight2?.SetValue("Color", colorOff); ////null check statusLCD?.WritePublicText("LIGHTS Off"); ////null check } else if (lightState == 1) getblocksoftype PasteShr getblocksoftype { foreach (IMyInteriorLight light in Toggled) { light.SetValue("Color", colorOn); } foreach (IMyInteriorLight light in RedLights) { light.SetValue("Color", colorYel); } getblocksoftype How to use it? getblocksoftype foreach (IMyInteriorLight light in YelLights) { light.SetValue("Color", colorOn); } statusLCD?.WritePublicText("LIGHTS Low Beam"); ////null check } else if (lightState == 2) { getblocksoftype How to get it? getblocksoftype IMyReflectorLight spotlight2 = GridTerminalSystem.GetBlockWithName("Spotlight") as IMyReflectorLight; spotlight2?.SetValue("Color", colorOn); ////null check statusLCD?.WritePublicText("LIGHTS High Beam"); ////null check } if (hdg.Z == -1 && done2 == false) { foreach(IMyMotorSuspension wheel in wheels) wheel.SetValue("Height", 40f); ////fixed single sillyness getblocksoftype How to dowload it? getblocksoftype done2 = true; } else if (hdg.Z == 1 && done2 == false) { foreach(IMyMotorSuspension wheel in wheels) wheel.SetValue("Height", -30f); ////fixed single sillyness done2 = true; } else getblocksoftype PasteShr getblocksoftype { done2 = false; } if(!shipController.HandBrake || CruiseControl == true) { foreach(IMyMotorSuspension wheel in wheels) wheel.SetValue("Friction", 0f); ////fixed single sillyness foreach (IMyInteriorLight light in BRKLights) getblocksoftype How to dowload it? getblocksoftype light.SetValue("Color", colorOff); } else { foreach(IMyMotorSuspension wheel in wheels) wheel.SetValue("Friction", 40f); ////fixed single sillyness foreach (IMyInteriorLight light in BRKLights) light.SetValue("Color", colorRear); } getblocksoftype How to get it for free? getblocksoftype if (shipController.GetShipSpeed() > 45) { foreach (IMyMotorSuspension wheel in wheelStabilizers) { var a = Single.Parse("40"); wheel.SetValue("Height", a); } statusLCD.WritePublicText("\nSTABILITY Active\n", true); } getblocksoftype How to get it? getblocksoftype else { foreach (IMyMotorSuspension wheel in wheelStabilizers) { var a = Single.Parse("-30"); wheel.SetValue("Height", a); } statusLCD.WritePublicText("\nSTABILITY Inactive\n", true); } getblocksoftype How to dowload it? getblocksoftype statusLCD.WritePublicText("Cruise Speed: " + CruiseControlSpeed.ToString(), true); if (CruiseControl == true) { var AccelThrusterGroup = GridTerminalSystem.GetBlockGroupWithName("ACL"); var Accelerators = new List(); AccelThrusterGroup.GetBlocksOfType(Accelerators); statusLCD.WritePublicText(" ACTIVE", true); getblocksoftype How to get it for free? getblocksoftype if (!shipController.DampenersOverride) { shipController.ApplyAction("DampenersOverride"); } lcd.WritePublicText(" CRUISE", true); if (shipController.GetShipSpeed() > CruiseControlSpeed) { getblocksoftype How to use it? getblocksoftype var val = Single.Parse("40"); foreach(IMyMotorSuspension wheel in wheels) { wheel.SetValue("Friction", val); } foreach(IMyThrust thruster in Accelerators) { getblocksoftype How to get it for free? getblocksoftype var thrustPower = Single.Parse("0"); thruster.SetValue("Override", thrustPower); } } else { targetAccel = (CruiseControlSpeed - shipController.GetShipSpeed()) * 100; getblocksoftype How to get it? getblocksoftype foreach(IMyThrust thruster in Accelerators) thruster.SetValue("Override", (float)targetAccel); ////Got rid of the single sillyness } } else { var AccelThrusterGroup = GridTerminalSystem.GetBlockGroupWithName("ACL"); var Accelerators = new List(); AccelThrusterGroup.GetBlocksOfType(Accelerators); getblocksoftype How to get it? getblocksoftype foreach(IMyThrust thruster in Accelerators) thruster.SetValue("Override", 0f); ////Got rid of the single sillyness } Echo($"Current Inst: {Runtime.CurrentInstructionCount}\nMax Inst:{Runtime.MaxInstructionCount}"); fancyLCD = GridTerminalSystem.GetBlockWithName("Left Center LCD") as IMyTextPanel; fancyLCD?.WritePublicText(" Systems ONLINE\n ELEKTRON Speed Display Active\n ZIVATAR Ready to drive"); ////added question mark } getblocksoftype How to get it? getblocksoftype // My Random Crap static char rgb(byte r, byte g, byte b) { return (char)(0xe100 + (r << 6) + (g << 3) + b); } void PrintSpeed(double spd) { //ONLY CALL WRITEPUBLICTEXT() ONCE!!!!!11!!!1!! getblocksoftype How to use it? getblocksoftype string line = new string(rgb(7, 0, 0), 20); string speedFill = new string(rgb(7, 7, 0), (int)(spd / 5)); lcd.WritePublicText($"{line}\n{speedFill}\n{line}\nSpeed: {spd:N2} m/s"); if (!shipController.DampenersOverride) { lcd?.WritePublicText(" DAMP OFF", true); ////added question mark } getblocksoftype PasteShr getblocksoftype } getblocksoftype