Larsen351

test2

Jun 9th, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. //Setting ship to known state
  2. set TVAL to 0.
  3. SAS off.
  4. RCS on.
  5. lights on.
  6. lock throttle to TVAL.
  7. gear off.
  8.  
  9. PRINT "Counting down:".
  10. FROM {local countdown is 10.} UNTIL countdown = 0 STEP {SET countdown to countdown - 1.} DO {
  11. PRINT "..." + countdown.
  12. WAIT 1. // pauses the script here for 1 second.
  13. }
  14.  
  15.  
  16. clearscreen.
  17.  
  18. set targetAp to 150000. //Target AP
  19. set targetPe to 150000. //target pe
  20.  
  21.  
  22.  
  23. set runmode to 2.
  24. if ALT:RADAR < 50 {
  25. set runmode to 1.
  26. }
  27.  
  28. if runmode = 1 {
  29. lock steering to UP.
  30. set TVAL to 1.
  31. PANELS off.
  32. wait 2.
  33. stage.
  34. set runmode to 2.
  35.  
  36.  
  37. if runmode = 2 {
  38. lock steering to heading(90,90).
  39. set TVAL to 1. }
  40. WAIT UNTIL SHIP:ALTITUDE > 10000. {
  41. set runmode to 3.
  42. }
  43.  
  44.  
  45. if runmode = 3 { //Turning time
  46. set targetPitch to max( 5, 90 * (1 - ALT:RADAR / 50000)).
  47. lock steering to heading (90, targetPitch).
  48. set TVAL to 1.
  49.  
  50. if SHIP:APOAPSIS > targetAp {
  51. set runmode to 4.
  52. }
  53. }
  54.  
  55. if runmode = 4 { // coast
  56. lock steering to heading ( 90,3).
  57. set TVAL to 0.
  58. if (SHIP:ALTITUDE > 70000) and (ETA:APOAPSIS > 60) and (VERTICALSPEED > 0) {
  59. if WARP = 0 {
  60. wait 1.
  61. set WARP to 3.
  62. }
  63. }.
  64.  
  65. if ETA:APOAPSIS < 60 {
  66. set WARP to 0.
  67. set runmode to 5.
  68. }
  69. }
  70.  
  71. if runmode = 5 { // PE burn start
  72. if ETA:APOAPSIS < 5 or VERTICALSPEED < 0 {
  73. set TVAL to 1.
  74. }
  75. if (SHIP:PERIAPSIS > targetPe) or (SHIP:PERIAPSIS > targetAp * 0.95) {
  76. set TVAL to 0.
  77. set runmode to 10.
  78. }
  79. }
  80.  
  81.  
  82. if runmode = 10 {
  83. set TVAL to 0.
  84. panels on.
  85. lights on.
  86. if RTADDON:AVAILABLE {
  87.  
  88. SET p TO SHIP:PARTSNAMED("communotron32")[1].
  89. SET m to p:GETMODULE("ModuleRTAntenna").
  90. m:DOEVENT("activate").
  91. }
  92. unlock steering.
  93. print "Welcome to space! i hope!".
  94.  
  95. }
  96.  
  97.  
  98.  
  99. //Housekeeping
  100.  
  101. if stage:Liquidfuel < 1 { // Staging if no fuel
  102. lock throttle to 0.
  103. wait 2.
  104. stage.
  105. wait 3.
  106. lock throttle to TVAL.
  107. }
  108. }
  109. //Printing!
  110. print "RUNMODE: " + runmode + " " at (5,4).
  111. print "ALTITUDE: " + round(SHIP:ALTITUDE) + " " at (5,5).
  112. print "APOAPSIS: " + round(SHIP:APOAPSIS) + " " at (5,6).
  113. print "PERIAPSIS: " + round(SHIP:PERIAPSIS) + " " at (5,7).
  114. print "ETA to AP: " + round(ETA:APOAPSIS) + " " at (5,8).
  115. print "Fuel Left: " + round(STAGE:LIQUIDFUEL) + " " at (5,9).
Advertisement
Add Comment
Please, Sign In to add comment