Skip to content

Instantly share code, notes, and snippets.

View KSAMissionCtrl's full-sized avatar
💭
Spacing space, sciencing all the science

Kerbal Space Agency KSAMissionCtrl

💭
Spacing space, sciencing all the science
View GitHub Profile
@KSAMissionCtrl
KSAMissionCtrl / LocalCtrl.ks
Created May 4, 2016 07:31
A way to control probes in real-time when dealing with RT2 signal delay. Mainly for pointing cameras
// REQUIRED: ActionGroupsExtended mod, which allows action group bindings to circumvent RT2 signal delay
// Can change action groups to whatever works for you, I use AGX to assign them to Numpad keys
set running to true.
set locked to true.
// exit the program
on AG8 { set running to false. }.
// kill rotation
@KSAMissionCtrl
KSAMissionCtrl / KerbalMass.cfg
Last active October 12, 2016 02:35
MM patch that gives mass to kerbals in ships
@PHYSICSGLOBALS
{
// http://forum.kerbalspaceprogram.com/index.php?/topic/15451-the-mass-of-a-kerbal/
// only affects craft mass in flight, not in the editor!
@kerbalCrewMass = 0.03125
}
@KSAMissionCtrl
KSAMissionCtrl / DarkTime.ks
Created November 23, 2016 20:00
How long your probe will orbit in the dark
// from https://redd.it/5eitfp
print "Estimation:"+round(1+abs(ETA:PERIAPSIS-ETA:APOAPSIS) * (arcsin(orbit:body:radius/(orbit:body:radius+altitude))/90))+ " s.".
@KSAMissionCtrl
KSAMissionCtrl / TrimCtrl.ks
Created April 6, 2017 23:47
Set trim via joystick buttongs using Advanced Fly-By Wire mod
// unfortunately this doesn't work great. Trim setting is not shown by moving the flight tabs
// furthermore while AFBW obeys trim when set with keys, setting with kOS causes a re-center of control during input
set pitchTrim to 0.
set yawTrim to 0.
set ship:control:pitchtrim to pitchTrim.
set ship:control:yawtrim to yawTrim.
until false {
clearscreen.
on AG3 {
set pitchTrim to pitchTrim + 0.01.
@KSAMissionCtrl
KSAMissionCtrl / SpaceAutosave.ks
Created December 13, 2017 03:27
Saves the game upon reaching space
when ship:altitude >= 70000 then {
if kuniverse:canquicksave {
// works if the engines are not thrusting
kuniverse:quicksaveto(ship:name).
} else {
// works under any circumstances
kuniverse:quicksave.
// wait for the engines to stop thrusting then saveto
when kuniverse:canquicksave then {
kuniverse:quicksaveto(ship:name).
@KSAMissionCtrl
KSAMissionCtrl / frictionCtrl.ks
Created January 26, 2018 11:56
Automatic control of wheel friction to prevent spinouts at high speeds on takeoff/landing
set tailwheel to ship:partstagged("tail")[0]:getmodule("modulewheelbase").
set mainwheels to ship:partstagged("main").
set state to "speedup".
until false {
if state = "speedup" and ship:velocity:surface:mag >= 25 {
set state to "slowdown".
tailwheel:setfield("friction control", 0).
mainwheels[0]:getmodule("kspwheelbase"):setfield("friction multiplier", 0).
mainwheels[1]:getmodule("kspwheelbase"):setfield("friction multiplier", 0).
@KSAMissionCtrl
KSAMissionCtrl / LOS.ks
Last active September 2, 2019 08:07
See if radio signal can be directly beamed to any point on or over Kerbin's surface
// draw vector from ship to comm station
until false {
vecdraw(V(0,0,0), latlng(-0.126280218823762,-74.6060470283197):altitudeposition(75), green, "", 1.0, true, 5).
wait 0.1.
clearvecdraws().
}.
@KSAMissionCtrl
KSAMissionCtrl / collectionScrape.js
Created February 19, 2020 19:01
uses Twitter API to grab all tweets in a collection
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});
var maxPos = null;
@KSAMissionCtrl
KSAMissionCtrl / logClean.bat
Created March 3, 2020 13:57
regexp search and replace to clear non-critical ERR and WRN statements from the KSP player.log using the Find and Replace application
start D:\"Steam Games"\steamapps\common\"Kerbal Space Program v1.5.1"\fnr.exe --cl --dir "D:\Steam Games\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.txt" --useRegEx --find "\[WRN.*\] Texture resolution" --replace ""
timeout 1
start D:\"Steam Games"\steamapps\common\"Kerbal Space Program v1.5.1"\fnr.exe --cl --dir "D:\Steam Games\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.txt" --useRegEx --find "\[ERR.*\].*Value is null during ValueUnitString" --replace ""
timeout 1
start D:\"Steam Games"\steamapps\common\"Kerbal Space Program v1.5.1"\fnr.exe --cl --dir "D:\Steam Games\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.txt" --useRegEx --find "\[WRN.*\] WheelCollider" --replace ""
timeout 1
start D:\"Steam Games"\steamapps\common\"Kerbal Space Program v1.5.1"\fnr.exe --cl --dir "D:\Steam Games\steamapps\common\Kerbal Space Program" --fileMask "*.log" --excludeFileMask "*.dll, *.txt" --useRegEx
@KSAMissionCtrl
KSAMissionCtrl / QuicksaveRename.bat
Created October 25, 2020 18:13
Monitors a folder for a quicksave to pop up and then renames it numerically, sequentially, so multiple quicksave files can be generated by kOS
@echo off
SET /A count = 0
echo quicksave renaming watch active
:loop
if exist "D:\Steam Games\steamapps\common\Kerbal Space Program\saves\Kerbal Space Agency\quicksave.sfs" (
timeout 1
rename "D:\Steam Games\steamapps\common\Kerbal Space Program\saves\Kerbal Space Agency\quicksave.sfs" "quicksave%count%.sfs"
set /A count = %count% + 1
)
goto loop