Files
ksp-kos-scripts/scripts/basic.ks
T

58 lines
1.3 KiB
Plaintext

// core:part:getmodule("kOSProcessor"):doevent("Open Terminal").
if ship:bounds:bottomaltradar > 5 {
print "Script shouldn't start off the ground".
} else {
set MODULES to list(
"ascent.ks",
"maneuver.ks",
"staging.ks",
"logger.ks"
).
for mod in MODULES {
copyPath("0:/scripts/" + mod, "1:/" + mod).
}
// #include ascent
run once ascent.
// --- GUI ---
local targetAlt is 80000.
local targetHdg is 90.
local guiConfirmed is false.
local g is GUI(300).
set g:x to 100.
set g:y to 100.
local titleLabel is g:addlabel("Ascent Parameters").
set titleLabel:style:align to "center".
set titleLabel:style:hstretch to true.
g:addlabel("Target Altitude (m):").
local altBox is g:addtextfield(targetAlt:tostring).
set altBox:style:hstretch to true.
g:addlabel("Heading (degrees):").
local hdgBox is g:addtextfield(targetHdg:tostring).
set hdgBox:style:hstretch to true.
local confirmBtn is g:addbutton("Launch").
set confirmBtn:onclick to {
set targetAlt to altBox:text:tonumber(targetAlt).
set targetHdg to hdgBox:text:tonumber(targetHdg).
set guiConfirmed to true.
g:hide().
}.
g:show().
wait until guiConfirmed.
g:dispose().
// --- END GUI ---
basicAscent(targetHdg, targetAlt).
// core:part:getmodule("kOSProcessor"):doevent("Close Terminal").
}