Advertisement
Guest User

startup

a guest
Dec 28th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. rs.setOutput("top", true)
  2. local exitTime = 10 -- change to whatever you want
  3. while true do
  4.   if rs.getAnalogInput("front")<15 then
  5. print (rs.getAnalogInput("front"))
  6.         local timer = os.startTimer(exitTime) -- starts the timer
  7.        while true do  
  8.         local evt, arg = os.pullEvent() -- wait for an event
  9.          if evt == "timer" then
  10.            if arg == timer then -- check if it's the correct timer
  11.          --   print ("timer stoped")
  12.              break -- break the loop
  13.            end
  14.          elseif (evt == "redstone" and rs.getInput("left")) then
  15.      --  print ("timer restart")
  16.            timer = os.startTimer(exitTime) -- restarts the timer
  17.         end
  18.       end
  19.       rs.setOutput("top", false)
  20.       sleep(0.2)
  21.       rs.setOutput("top", true)
  22.      
  23.      end
  24.  
  25. sleep(0.5)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement