Advertisement
Guest User

GenBoot.ks v0.2.0 Generic Boot script Author - Scar

a guest
Dec 9th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. // GenBoot.ks v0.2.0
  2. // Generic Boot script
  3. // Author - Scarlet-Laura
  4.  
  5. set ship:control:pilotmainthrottle to 0.
  6.  
  7. function NOTIFY {
  8. parameter message.
  9. HUDTEXT("kOS: " + message, 5, 2, 50, WHITE, false).
  10. }
  11.  
  12. NOTIFY("SYSTEM BOOT IN PROGRESS...").
  13.  
  14. // File manager starts here
  15.  
  16. // Detect existance of file of intrest
  17. function hasFile {
  18. parameter name. // Name of file of intrest
  19. parameter vol. // Volume to search
  20.  
  21. switch to vol.
  22. list files in allFiles.
  23. for file in allFiles {
  24. if file:name = name {
  25. switch to 1.
  26. print "We Have It". // debug test - doesn't print
  27. wait 5.
  28. return true.
  29. }
  30. }
  31. switch to 1.
  32. return false.
  33. }
  34.  
  35. // Get file from KSC - seems inoprable when called
  36. function download {
  37. parameter name.
  38.  
  39. if hasFile(name, 1) {
  40. deletepath("1:/name").
  41. }
  42. if hasFile(name, 0) {
  43. copypath("0:/name", "1:/").
  44. }
  45. }
  46.  
  47. // Send file to KSC
  48. function upload {
  49. parameter name.
  50.  
  51. if hasFile(name, 0) {
  52. switch to 0.
  53. deletepath("0:/name").
  54. switch to 1.
  55. }
  56. if hasFile(name, 1) {
  57. copypath("1:/name", "0:/").
  58. }
  59. }
  60.  
  61. // Actual Bootup Process
  62. set updateScript to ship:name + "update.ks". // syntax works on its own
  63.  
  64. // check for and run new instructions - Doesn't trigger any error, but seems nonfunctional
  65. if hasFile(updateScript, 0) {
  66. copypath("0:/updateScript", "1:/"). // Tested manualy, seems to work
  67. switch to 0.
  68. deletepath("0:/updateScript").
  69. switch to 1.
  70. runpath("1:/updateScript").
  71. }
  72.  
  73.  
  74. // If startup.ks file exists onboard, run that - Script appears to fall straight to here and
  75. // follow the 10 second reboot
  76. set startup to ship:name + "startup.ks".
  77. if hasFile(startup, 1) {
  78. runpath("1:/startup").
  79. }
  80. else {
  81. wait 10.
  82. reboot.
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement