Advertisement
monsterzack5

asdasdasdasd

Feb 15th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Main program initilizing")
  2.  
  3. local reactor = peripheral.wrap("back")
  4. local cell = peripheral.wrap("right")
  5. local glasses = peripheral.wrap("left")
  6. rt = false
  7.  
  8.  
  9.  
  10.  
  11.  
  12. while true do
  13.   cellState = cell.getEnergyStored()
  14.   cellPercent = ((cellState / 80000000) * 100)
  15.  
  16.  
  17.    
  18.   if ((cellPercent < 20) and (rt == false)) then
  19.     reactor.setActive(true)
  20.     rt = true
  21.     print("Reactor is on")
  22.   end
  23.  
  24.   if ((cellPercent > 90) and (rt == true)) then
  25.     reactor.setActive(false)
  26.     rt = false
  27.     print("Reactor is off")
  28.   end
  29.  
  30.   sleep(0.5)
  31.  
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement