hilburn

Quarry Active turtle script

Sep 26th, 2014
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local timer_reset=5 --time in seconds between checking for activity
  2. --------------------------------------------------------
  3. local active=false
  4. local run=true
  5. os.startTimer(timer_reset)
  6. while run do
  7.     local event=os.pullEvent()
  8.     if event == "turtle_inventory" then         -- if something is messing with the inventory
  9.         active=true             -- the miner is active
  10.     elseif event == "timer" then            -- if the timer has timed out
  11.         if active then              -- if it has done something since last timer
  12.             os.startTimer(timer_reset)  -- start a new timer
  13.             active=false            -- reset boolean
  14.         else                    -- otherwise
  15.             rs.setOutput("top",true)    -- output redstone on top face
  16.             run=false           -- stop running        
  17.         end
  18.     end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment