DrFair

Miningbore computer

Jun 20th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Args = {...}
  2. wr = peripheral.wrap("right")
  3. h = 5
  4. idletime = 10
  5.  
  6. function pulse(freq,t)
  7. wr.setFreq(freq)
  8. redstone.setOutput("right",true)
  9. os.sleep(t)
  10. redstone.setOutput("right",false)
  11. os.sleep(0.2)
  12. end
  13.  
  14. function mine()
  15. pulse(549,0.5)
  16. end
  17.  
  18. function boreDown()
  19. pulse(551,1.2)
  20. end
  21.  
  22. function boreUp()
  23. pulse(552,1.2)
  24. end
  25.  
  26. function goFor()
  27. pulse(553,1.2)
  28. end
  29.  
  30. function goBack()
  31. pulse(554,1.2)
  32. end
  33.  
  34. function cycle()
  35. mine()
  36. os.sleep(0.5)
  37. for i=1,h do
  38. boreDown()
  39. os.sleep(0.5)
  40. mine()
  41. os.sleep(1.5)
  42. mine()
  43. os.sleep(1.5)
  44. mine()
  45. os.sleep(0.5)
  46. end
  47. for i=1,h do
  48. boreUp()
  49. os.sleep(5)
  50. end
  51. goFor()
  52. os.sleep(idletime)
  53. end
  54.  
  55. while true do
  56. os.sleep(0.5)
  57. if #Args == 0 then
  58. if rs.getInput("top") then
  59. cycle()
  60. os.sleep(0.5)
  61. end
  62. else
  63. if Args[1] == "goback" then
  64. goBack()
  65. break
  66. elseif Args[1] == "gofor" then
  67. goFor()
  68. break
  69. elseif Args[1] == "boreup" then
  70. boreUp()
  71. break
  72. elseif Args[1] == "boredown" then
  73. boreDown()
  74. break
  75. elseif Args[1] == "mine" then
  76. mine()
  77. break
  78. elseif Args[1] == "cycle" then
  79. cycle()
  80. break
  81. end
  82. end
  83. end
Advertisement
Add Comment
Please, Sign In to add comment