Advertisement
Guest User

startup

a guest
Dec 13th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local reactor = peripheral.wrap("back")
  2. local output
  3. local looper = true
  4.  
  5. function customSleep()
  6.   local timer = os.startTimer(5)
  7.  
  8.   repeat
  9.     local sEvent, param = os.pullEvent( "timer" )
  10.   until param == timer
  11. end
  12.  
  13.  
  14.  
  15. while true do
  16.   output = "" .. os.time()
  17.   if not reactor.getConnected() then
  18.     output = output.. "no reactor connected"
  19.   else
  20.     if reactor.getActive() then
  21.       output = output .. " reactor is active at "
  22.     else
  23.       output = output .. " reactor is disabled at "
  24.     end
  25.     output = output .. reactor.getEnergyStored() .. "RF"
  26.  
  27.     if reactor.getEnergyStored() < 3000000 then
  28.       reactor.setActive(true)
  29.     end
  30.     if reactor.getEnergyStored() > 7000000 then
  31.       reactor.setActive(false)
  32.     end
  33.  
  34.   end
  35.    
  36.   print(output)
  37.   os.startTimer(5)
  38.   os.pullEvent( "timer")
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement