Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GenBoot.ks v1.0.0
- // Generic Boot script
- // Author - Scarlet-Laura
- set ship:control:pilotmainthrottle to 0.
- function NOTIFY {
- parameter message.
- HUDTEXT("kOS: " + message, 5, 2, 50, WHITE, false).
- }
- NOTIFY("SYSTEM BOOT IN PROGRESS...").
- // File manager starts here
- // Detect existence of file of interest
- function hasFile {
- parameter name. // Name of file of interest
- parameter vol. // Volume to search
- local searchIn is vol + ":/".
- if exists(searchIn + name) {
- return true.
- } else {
- return false.
- }
- }
- // Get file from KSC - seems inoprable when called
- function download {
- parameter name.
- if hasFile(name, 1) {
- deletepath("1:/" + name).
- }
- if hasFile(name, 0) {
- copypath("0:/" + name, "1:/").
- }
- }
- // Send file to KSC
- function upload {
- parameter name.
- if hasFile(name, 0) {
- switch to 0.
- deletepath("0:/" + name).
- switch to 1.
- }
- if hasFile(name, 1) {
- copypath("1:/" + name + ", 0:/").
- }
- }
- // Actual Bootup Process
- set updateScript to ship:name + ".update.ks".
- // eg: Ship name - Kerbal X; updateScript = Kerbal X.update.ks
- // check for and run new instructions
- if hasFile(updateScript, 0) {
- NOTIFY("Update Found").
- download(updateScript).
- switch to 0.
- deletepath("0:/" + updateScript).
- switch to 1.
- NOTIFY("Running Update").
- wait 1.
- runpath("1:/" + updateScript).
- }
- // If startup.ks file exists onboard, run that automatically
- set startup to ship:name + ".startup.ks".
- if hasFile(startup, 1) {
- runpath("1:/" + startup).
- }
- else {
- wait 10.
- reboot.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement