DrFair

MW C

Mar 20th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Args = {...}
  2. wr = peripheral.wrap("right")
  3.  
  4. function printUsage()
  5. print("Usage:")
  6. print("Quarry <N>")
  7. print("Will quarry N times forward.")
  8. end
  9.  
  10. function pulse(freq,num)
  11. wr.setFreq(freq)
  12. for i=1,num do
  13. redstone.setOutput("right",true)
  14. os.sleep(0.8)
  15. redstone.setOutput("right",false)
  16. os.sleep(1)
  17. end
  18. end
  19.  
  20. function quarry(num)
  21. for i=1,num do
  22. redstone.setOutput("back",true)
  23. os.sleep(2)
  24. redstone.setOutput("back",false)
  25. os.sleep(20)
  26. pulse(1337,1)
  27. end
  28. end
  29.  
  30. if #Args ~= 1 then
  31. printUsage()
  32. else
  33. if tonumber(Args[1]) == 0 then
  34. printUsage()
  35. else
  36. quarry(tonumber(Args[1]))
  37. end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment