Bonkie

Quarry control

Apr 7th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. function mine(d)
  2.   if (d=="stop") then
  3.     redstone.setOutput("bottom",false)
  4.     redstone.setOutput("front",true)
  5.   elseif (d=="start") then
  6.     redstone.setOutput("bottom",true)
  7.     redstone.setOutput("front",false)
  8.   end
  9. end
  10.  
  11. while true do
  12.   event = os.pullEvent()
  13.   if event == "redstone" then
  14.     if redstone.getInput("back")==true then
  15.  
  16.       print("Back redstone")
  17.  
  18.       mine("stop")
  19.  
  20.       sleep(5)
  21.       for i=1,8 do
  22.         print(i)
  23.         redstone.setOutput("left",true)
  24.         sleep(0.9)
  25.         redstone.setOutput("left",false)
  26.         sleep(0.9)
  27.       end
  28.  
  29.       mine("start")
  30.  
  31.     elseif redstone.getInput("top")==true then
  32.  
  33.       print("Top redstone")
  34.  
  35.       mine("stop")
  36.  
  37.       sleep(5)
  38.  
  39.       a=true
  40.       while a==true do
  41.         ev = os.pullEvent()
  42.         if ev=="redstone" then
  43.           if redstone.getInput("top")==false then
  44.             a=false
  45.           end
  46.         end
  47.       end
  48.  
  49.       mine("start")
  50.  
  51.     end
  52.   end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment