Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 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(26,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(26,39,7,7,colors.black,tostring(localEnergy), colors.lime)
  38.  
  39. drawBox(1,39,8,8,colors.black," ", colors.black)
  40. drawBox(1,19,9,9,colors.red,"Energy Production",colors.white)
  41. drawBox(26,39,9,9,colors.black,tostring(energyLastTick), colors.lime)
  42.  
  43. end
  44.  
  45.  
  46. function drawBox(xa,xb,ya,yb, bgcolor,text,textcolor)
  47. monitor.setCursorPos(xa,ya)
  48. monitor.setTextColor(textcolor)
  49. for y = ya,yb,1 do
  50.  
  51. for x = xa,xb,1 do
  52. monitor.setCursorPos(x,y)
  53. monitor.setBackgroundColor(bgcolor)
  54. monitor.write(" ")
  55. end
  56.  
  57.  
  58. xPos =1+ math.floor (xb/2) - math.floor( string.len(text)/2 )
  59. monitor.setCursorPos(xPos,(ya+yb)/2)
  60. monitor.write(text)
  61.  
  62. end
  63. monitor.setCursorPos(xa,yb+1)
  64. monitor.setBackgroundColor(colors.black)
  65. monitor.write(" ")
  66. end
  67.  
  68. while true do
  69. main()
  70. sleep(1)
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement