TheSpicePhantom

First One

May 12th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. r = peripheral.find("BigReactors-Reactor")
  2. mon = peripheral.find("monitor")
  3.   enMax = 10000000
  4.   enMaxIn = 90000
  5.   enMaxTo = 5000000
  6.  
  7.  
  8. function updateMon()
  9.   mon.setCursorPos(1,1)
  10.   mon.setTextColor(colors.white)
  11. end
  12.  
  13. function setReactorOff()
  14.   r.setActive(false)
  15. end
  16.  
  17. function BootUp()
  18.   mon.clear()
  19.   mon.setBackgroundColor(colors.cyan)
  20.   local v = 1
  21.   for i = 1,19 do
  22.     mon.setCursorPos(1,v)
  23.     mon.write("[                                                                     ]")
  24.     v = v+1
  25.   end
  26.   sleep(0.2)
  27.     mon.setCursorPos(33,5)
  28.     mon.setBackgroundColor(colors.red)
  29.     mon.write("   ")
  30.     mon.setCursorPos(33,5+1)
  31.     mon.write("   ")
  32.     sleep(0.5)
  33.     mon.setCursorPos(33+4,5)
  34.     mon.setBackgroundColor(colors.lime)
  35.     mon.write("   ")
  36.     mon.setCursorPos(33+4,5+1)
  37.     mon.write("   ")
  38.     sleep(0.5)
  39.     mon.setCursorPos(33,5+3)
  40.     mon.setBackgroundColor(colors.blue)
  41.     mon.write("   ")
  42.     mon.setCursorPos(33,5+1+3)
  43.     mon.write("   ")
  44.     sleep(0.5)
  45.     mon.setCursorPos(33+4,5+3)
  46.     mon.setBackgroundColor(colors.yellow)
  47.     mon.write("   ")
  48.     mon.setCursorPos(33+4,5+4)
  49.     mon.write("   ")
  50.     sleep(3)
  51. end
  52.  
  53. function buttonCreateSparmodus()
  54.   --Sparmodus
  55.   mon.setCursorPos(3,2)
  56.   mon.setBackgroundColor(colors.red)
  57.   mon.setTextColor(colors.black)
  58.   mon.write(" Sparmodus ")
  59.   mon.setBackgroundColor(colors.cyan)  
  60. end
  61. function buttonCreatePowerPlus()
  62.   --PowerPlus
  63.   mon.setCursorPos(3,4)
  64.   mon.setBackgroundColor(colors.red)
  65.   mon.setTextColor(colors.black)
  66.   mon.write(" PowerPlus ")
  67.   mon.setBackgroundColor(colors.cyan)
  68. end
  69. function buttonCreateVolldampf()
  70.   --Volldampf
  71.   mon.setCursorPos(3,6)
  72.   mon.setBackgroundColor(colors.red)
  73.   mon.setTextColor(colors.black)
  74.   mon.write(" Volldampf ")
  75.   mon.setBackgroundColor(colors.cyan)
  76. end
  77. --function buttonCreateUpdate()
  78.   --Update
  79.   --mon.setCursorPos(3,18)
  80.   --mon.setBackgroundColor(colors.lime)
  81.   --mon.setTextColor(colors.black)
  82.   --mon.write(" Update ")
  83.   --mon.setBackgroundColor(colors.cyan)
  84. --end
  85. function buttonCreateReset()
  86.   --Control level to 0
  87.   mon.setCursorPos(3,8)
  88.   mon.setBackgroundColor(colors.red)
  89.   mon.setTextColor(colors.black)
  90.   mon.write("   Reset   ")
  91.   mon.setBackgroundColor(colors.cyan)
  92. end
  93. function buttonCreateOff()
  94.   --An/Aus
  95.   mon.setCursorPos(64,2)
  96.   mon.setBackgroundColor(colors.red)
  97.   mon.setTextColor(colors.black)
  98.   mon.write("     ")
  99.   mon.setCursorPos(64,2+1)
  100.   mon.write("  A  ")
  101.   mon.setCursorPos(64,2+2)
  102.   mon.write("  U  ")
  103.   mon.setCursorPos(64,2+3)
  104.   mon.write("  S  ")
  105.   mon.setCursorPos(64,2+4)
  106.   mon.write("     ")
  107.   mon.setBackgroundColor(colors.cyan)
  108. end
  109. function buttonCreateOn()
  110.   mon.setCursorPos(58,2)
  111.   mon.setBackgroundColor(colors.red)
  112.   mon.setTextColor(colors.black)
  113.   mon.write("     ")
  114.   mon.setCursorPos(58,2+1)
  115.   mon.write("  A  ")
  116.   mon.setCursorPos(58,2+2)
  117.   mon.write("  N  ")
  118.   mon.setCursorPos(58,2+3)
  119.   mon.write("     ")
  120.   mon.setCursorPos(58,2+4)
  121.   mon.write("     ")
  122.   mon.setBackgroundColor(colors.cyan)
  123. end
  124. function buttonCreateLISTEN()
  125.   mon.setCursorPos(14,18)
  126.   mon.setBackgroundColor(colors.red)
  127.   mon.setTextColor(colors.black)
  128.   mon.write("LISTEN")
  129.   mon.setBackgroundColor(colors.cyan)
  130. end
  131.  
  132. function buttonLoadAll()
  133. event, side, x, y = os.pullEvent("monitor_touch")
  134.     --if x > 3 and x < 8 and y == 18 then
  135.       --mon.setCursorPos(3,18)
  136.       --mon.setBackgroundColor(colors.orange)
  137.       --mon.setTextColor(colors.black)
  138.       --mon.write(" Update ")
  139.       --sleep(0.5)
  140.       --mon.setBackgroundColor(colors.cyan)
  141.       --shell.run("Update")
  142.     --end
  143.     if x > 3 and x < 14 and y == 2 then
  144.       mon.setCursorPos(3,2)
  145.       mon.setBackgroundColor(colors.lime)
  146.       mon.setTextColor(colors.black)
  147.       mon.write(" Sparmodus ")
  148.       r.setAllControlRodLevels(99)
  149.       mon.setBackgroundColor(colors.cyan)
  150.     elseif x > 3 and x < 14 and y == 4 or y == 6 then
  151.       buttonCreateSparmodus()
  152.     end
  153.     if x > 3 and x < 14 and y == 4 then
  154.       mon.setCursorPos(3,4)
  155.       mon.setBackgroundColor(colors.lime)
  156.       mon.setTextColor(colors.black)
  157.       mon.write(" PowerPlus ")
  158.       r.setAllControlRodLevels(70)
  159.       mon.setBackgroundColor(colors.cyan)
  160.     elseif x > 3 and x < 14 and y == 2 or y == 6 then
  161.       buttonCreatePowerPlus()
  162.     end
  163.     if x > 3 and x < 14 and y == 6 then
  164.       mon.setCursorPos(3,6)
  165.       mon.setBackgroundColor(colors.lime)
  166.       mon.setTextColor(colors.black)
  167.       mon.write(" Volldampf ")
  168.       r.setAllControlRodLevels(0)
  169.       mon.setBackgroundColor(colors.cyan)
  170.     elseif x > 3 and x < 14 and y == 2 or y == 4 then
  171.       buttonCreateVolldampf()
  172.     end
  173.     if x > 3 and x < 14 and y == 8 then
  174.       mon.setCursorPos(3,8)
  175.       mon.setBackgroundColor(colors.lime)
  176.       mon.setTextColor(colors.black)
  177.       mon.write("   Reset   ")
  178.       r.setAllControlRodLevels(0)
  179.       mon.setBackgroundColor(colors.cyan)
  180.       buttonCreateSparmodus()
  181.       buttonCreatePowerPlus()
  182.       buttonCreateVolldampf()
  183.       sleep(0.2)
  184.       buttonCreateReset()
  185.     end
  186.     if x > 64 and x < 69 and y >= 2 and y <= 6 then
  187.       mon.setCursorPos(64,2)
  188.       mon.setBackgroundColor(colors.lime)
  189.       mon.setTextColor(colors.black)
  190.       mon.write("     ")
  191.       mon.setCursorPos(64,2+1)
  192.       mon.write("  A  ")
  193.       mon.setCursorPos(64,2+2)
  194.       mon.write("  U  ")
  195.       mon.setCursorPos(64,2+3)
  196.       mon.write("  S  ")
  197.       mon.setCursorPos(64,2+4)
  198.       mon.write("     ")
  199.       r.setActive(false)
  200.       buttonCreateOn()
  201.     end
  202.     if x > 58 and x < 64 and y >= 2 and y <= 6 then
  203.       mon.setCursorPos(58,2)
  204.       mon.setBackgroundColor(colors.lime)
  205.       mon.setTextColor(colors.black)
  206.       mon.write("     ")
  207.       mon.setCursorPos(58,2+1)
  208.       mon.write("  A  ")
  209.       mon.setCursorPos(58,2+2)
  210.       mon.write("  N  ")
  211.       mon.setCursorPos(58,2+3)
  212.       mon.write("     ")
  213.       mon.setCursorPos(58,2+4)
  214.       mon.write("     ")
  215.       r.setActive(true)
  216.       buttonCreateOff()
  217.     end
  218.     if x > 14 and x < 20 and y == 18 then
  219.       mon.setCursorPos(14,18)
  220.       mon.setBackgroundColor(colors.orange)
  221.       mon.setTextColor(colors.red)
  222.       mon.write("LISTEN")
  223.       shell.openTab(".listen")
  224.       mon.setCursorPos(14,19)
  225.       mon.setBackgroundColor(colors.cyan)
  226.       mon.write(" BETA ")
  227.       mon.setBackgroundColor(colors.cyan)
  228.     end      
  229. end
  230.  
  231. function getPercentEnergy()
  232.   enPer = math.floor(enNow/enMax*100)
  233. end
  234.  
  235. function pushEnergy()
  236.   mon.setCursorPos(42,2)
  237.   mon.setBackgroundColor(colors.cyan)
  238.   mon.setTextColor(colors.black)
  239.   mon.write("Energie: ")
  240.   mon.setCursorPos(42,2+1)
  241.   enNow = r.getEnergyStored()
  242.   mon.write(enNow)
  243.   mon.setCursorPos(42,2+2)
  244.   mon.write(enPer)
  245. end
  246.  
  247. updateMon()
  248. BootUp()
  249.  
  250. buttonCreateSparmodus()
  251. buttonCreatePowerPlus()
  252. buttonCreateVolldampf()
  253. buttonCreateReset()
  254. buttonCreateLISTEN()
  255. buttonCreateOn()
  256.  
  257. while true do
  258.   buttonLoadAll()
  259. end
  260.  
  261. while true do
  262.   pushEnergy()
  263.   getPercentEnergy()
  264.   sleep(0.1)
  265. end
Add Comment
Please, Sign In to add comment