Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. local monitor = peripheral.find("monitor")
  2. local reactor = peripheral.find("BigReactors-Reactor")
  3.  
  4. local turnOnAt = 20
  5. local turnOffAt = 90
  6.  
  7. local localEnergy = 0
  8. local status = false
  9. local energyLastTick = 0
  10.  
  11. function main()
  12.  
  13. drawScreen()
  14.  
  15. end
  16.  
  17.  
  18. function getValues()
  19. status = reactor.getActive()
  20. localEnergy = reactor.getEnergyStored()
  21. energyLastTick = reactor.getEnergyProducedLastTick()
  22.  
  23.  
  24. end
  25.  
  26. function drawScreen()
  27. monitor.clear()
  28. monitor.setTextScale(1)
  29. monitor.setBackgroundColor(colors.black)
  30. drawBox(1,39,1,3,colors.red,"Reactor Control",colors.white)
  31. drawBox(1,39,4,4,colors.black," ", colors.black)
  32. drawBox(1,19,5,5,colors.red,"Status",colors.white)
  33. drawBox(21,39,5,5,colors.black,tostring(status), colors.lime)
  34.  
  35. drawBox(1,39,6,6,colors.black," ", colors.black)
  36. drawBox(1,19,7,7,colors.red,"EnergyStored",colors.white)
  37. drawBox(21,39,7,7,colors.black,tostring(localEnergy), colors.lime)
  38.  
  39. end
  40.  
  41.  
  42. function drawBox(xa,xb,ya,yb, bgcolor,text,textcolor)
  43. monitor.setCursorPos(xa,ya)
  44. monitor.setTextColor(textcolor)
  45. for y = ya,yb,1 do
  46.  
  47. for x = xa,xb,1 do
  48. monitor.setCursorPos(x,y)
  49. monitor.setBackgroundColor(bgcolor)
  50. monitor.write(" ")
  51. end
  52.  
  53.  
  54. xPos =1+ math.floor (xb/2) - math.floor( string.len(text)/2 )
  55. monitor.setCursorPos(xPos,(ya+yb)/2)
  56. monitor.write(text)
  57.  
  58. end
  59. monitor.setCursorPos(xa,yb+1)
  60. monitor.setBackgroundColor(colors.black)
  61. monitor.write(" ")
  62. end
  63.  
  64. while true do
  65. main()
  66. sleep(1)
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement