Advertisement
niwo

KSP_kOS_status_0.2.ks

Aug 21st, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.13 KB | None | 0 0
  1. // Flight Status Script for kOS mod for Kerbal Space Program
  2. // by Niwo
  3. // Version: 0.2
  4. // TODO: Sort and Group and Space Sections.
  5.  
  6.  
  7. // Declaration:
  8. // SET vStat TO SHIP:PARTSDUBBED("Flight.Status")[0]. // Todo later
  9. set panel to 0.
  10. on ship:panels {
  11.   set panel to 1.
  12.   }
  13. clearscreen.
  14.  
  15.     //Print data to screen.
  16.     UNTIL FALSE { // CTRL+C to break out
  17.     // print "Running Module " + vStat + "      " at (2,1).
  18. // Line 1
  19.     print "Flight Status:    " + status + "      " at (2,1).
  20. // Line 2  
  21.     if SESSIONTIME < 59 {
  22.     print "Session Time:     " + round(SESSIONTIME) + " s" at (2,2).
  23.     }.
  24.     else {
  25.     print "Session Time:     " + round(SESSIONTIME / 60 )+ " min" at (2,2).
  26.     }.
  27. // Line 3  
  28.     print "================================================" at (2,3).
  29. // Line 4  
  30.     if ALT:RADAR < 1000 {
  31.         print "ALTITUDE (RADAR): " + round(ALT:RADAR) + " m   " at (2,4).
  32.     }.
  33.         else if ALT:RADAR < 1000000{
  34.         print "ALTITUDE (RADAR): " + round(ALT:RADAR / 1000) + " km   " at (2,4).
  35.         }
  36.         else {
  37.         print "ALTITUDE (RADAR): " + round(ALT:RADAR / 1000000) + " Mm    " at (2,4).
  38.         }
  39. // Line 5       .
  40.     if SHIP:ALTITUDE < 1000 {
  41.         print "ALTITUDE (ASL):   " + round(SHIP:ALTITUDE) + " m    " at (2,5).
  42.     }.
  43.         else if SHIP:ALTITUDE < 1000000{
  44.         print "ALTITUDE (ASL):   " + round(SHIP:ALTITUDE / 1000) + " km    " at (2,5).
  45.         }.
  46.         else {
  47.         print "ALTITUDE (ASL):   " + round(SHIP:ALTITUDE / 1000000) + " Mm     " at (2,5).
  48.         }.
  49. // Line 6      
  50.     if SHIP:APOAPSIS > 1000000 or SHIP:APOAPSIS < -1000000{
  51.         print "APOAPSIS:         " + round(SHIP:APOAPSIS / 1000000) + " Mm     " at (2,6).
  52.     }
  53.     else if SHIP:APOAPSIS > 1000 {
  54.     print "APOAPSIS:         " + round(SHIP:APOAPSIS / 1000) + " km " at (2,6).
  55.     }.
  56.         else {
  57.         print "APOAPSIS:         " + round(SHIP:APOAPSIS) + " m     " at (2,6).
  58.         }.
  59. // Line 7  
  60.     if SHIP:PERIAPSIS > 1000000 or SHIP:PERIAPSIS < -1000000 {
  61.     print "PERIAPSIS:        " + round(SHIP:PERIAPSIS / 1000000, 1) + " Mm      " at (2,7).
  62.     }.
  63.     else if SHIP:PERIAPSIS > 1000 or SHIP:PERIAPSIS < -1000 {
  64.         print "PERIAPSIS:        " + round(SHIP:PERIAPSIS / 1000) + " km      " at (2,7).
  65.     }.
  66.         else {
  67.         print "PERIAPSIS:        " + round(SHIP:PERIAPSIS) + " m     " at (2,7).
  68.         }.
  69. // Line 8   // Fix hours
  70.     if ETA:APOAPSIS < 59 {
  71.     print "ETA to AP:        " + round(ETA:APOAPSIS) + " s     " at (2,8).
  72.     }.
  73.     else if ETA:APOAPSIS < 3600 {
  74.     print "ETA to AP:        " + round(ETA:APOAPSIS / 60 ) + " m  " at (2,8).
  75.     // print "ETA to AP:        " + round(ETA:APOAPSIS / 60 ) + ":" +  ((ETA:APOAPSIS / 60 ) - round(ETA:APOAPSIS / 60 )) + " min  " at (2,8).
  76.     }.
  77.     else if ETA:APOAPSIS < 86400 {
  78.     print "ETA to AP:        " + round(ETA:APOAPSIS / 3600, 1 ) + " h  " at (2,8).
  79.     }.
  80.     else if ETA:APOAPSIS > 86400 {
  81.     print "ETA to AP:        " + round(ETA:APOAPSIS / 3600 / 24 ) + " d  " at (2,8).
  82.     }.
  83. // Line 9
  84.     print "Ambient Temp.:    " + round(Ship:Sensors:TEMP) + " K    " at (2,9).
  85.    
  86. // Line 10 
  87.     print "Pressure:         " + round(Ship:Sensors:pres) + " atm  " at (2,10).
  88. // Line 11 
  89.     set lChrg to 11.
  90.     print "Electric Charge:  " + round(Ship:electricCharge) + " " at (2,lChrg).
  91.    
  92. // Line 12 
  93.     set lExp to 12.
  94.     print "Sun Exposure:     " + round(Ship:Sensors:Light) + "      " at (2,lExp)
  95.         if round(Ship:Sensors:Light) < 2 {
  96.             print "low " at (28,lExp).
  97.             }.
  98.             else if round(Ship:Sensors:Light) < 6 {
  99.             print "med " at (28,lExp).
  100.             }.
  101.             else if round(Ship:Sensors:Light) > 6 {
  102.             print "High" at (28,lExp).
  103.             }.
  104.        
  105.        
  106. // Line 13 
  107.  
  108. // Line 14
  109.     // TODO FUEL BAR:
  110. set lFuel to 13.   
  111. if ship:liquidfuel > 0.1 {
  112.     print "Liquid Fuel:      " + round(ship:liquidfuel) + " " at (2,lFuel).
  113.     // print "Liquid Fuel:      " + round(ship:liquidfuel*2.5693) + " Liter" at (2,15).
  114.     if ship:liquidfuel < 100  {
  115.         print "WARNING! FUEL LOW!" at (28,lFuel).
  116.  
  117.     }.
  118. }.
  119. // Line 15
  120. // ...
  121.  
  122.     if ALT:RADAR < 5000 and ALT:RADAR > 50 {
  123.         print "WARNING! ALTITUDE LOW!" at (28,4).
  124.  
  125.     }.
  126.    
  127. // Charging?
  128.         set sChrg to ship:ELECTRICCHARGE.
  129.             wait 0.05.
  130.             if ship:ELECTRICCHARGE > sChrg {
  131.                 print "Charging.            " at (28,lChrg).
  132.                 // set sChrg to ship:ELECTRICCHARGE. // Obsolete.
  133.                 set charging to 1.
  134.                 wait 0.5.
  135.             }.
  136.                 else if ship:ELECTRICCHARGE < sChrg{
  137.                 print "Discharging.         " at (28,lChrg).
  138.                 set charging to 0.
  139.                 wait 0.5.
  140.                 // set sChrg to ship:ELECTRICCHARGE. // Obsolete.
  141.                 }.
  142.                 // else if (ship:ELECTRICCHARGE / sChrg) = 1 {
  143.                 else if ship:ELECTRICCHARGE = sChrg {
  144.                 print "Battery Full.     " at (28,lChrg).
  145.                 set sChrg to ship:ELECTRICCHARGE. // Obsolete.
  146.                 }.
  147.            
  148.            
  149.    
  150.     if ship:ELECTRICCHARGE < 100 {
  151.     print "WARNING! BATTERY LOW!" at (28,lChrg).
  152.     wait 0.5.
  153.     // print "                     "  at (28,lChrg).
  154.     // wait 0.5.
  155.     }.
  156.     when ship:ELECTRICCHARGE < 100 and charging = 0 then {
  157.         if warp > 0 {
  158.                 set WARP to 0.
  159.                 }.
  160.         // set WARP to 0.
  161.         preserve.
  162.     }.
  163.  
  164. // ON AG99 {
  165.    // PRINT "Action Group 99 Activated!".
  166.    // clearscreen.
  167.    // set false to 1.
  168.    // break.
  169.    
  170. // }
  171. // ON AG99 {
  172.     // PRINT "Action Group 99 activated.".
  173.     // PRESERVE.
  174. // }
  175.    
  176.    
  177.  
  178.     if false = 1 {
  179.         clearscreen. // Is not captured when escaping with ctrl + c :(
  180.         }.
  181.         }.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement