Advertisement
Erit1566

Untitled

Jun 20th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. rednet.open("right")
  2. function LookLeft(distance)
  3. for i = 1,distance do
  4. turtle.turnLeft()
  5. end
  6. end
  7. function LookRight(distance)
  8. for i = 1,distance do
  9. turtle.turnRight()
  10. end
  11. end
  12. function forward(distance)
  13. for i = 1,distance do
  14. turtle.forward()
  15. end
  16. end
  17. function back(distance)
  18. for i = 1,distance do
  19. turtle.back()
  20. end
  21. end
  22. function mine(distance)
  23. for i = 1,distance do
  24. turtle.dig()
  25. sleep(1.5)
  26. turtle.digUp()
  27. sleep(1.5)
  28. turtle.digDown()
  29. end
  30. end
  31. function up(distance)
  32. for i = 1,distance do
  33. turtle.up()
  34. end
  35. end
  36. function left(distance)
  37. turtle.turnLeft()
  38. for i = 1,distance do
  39. turtle.forward()
  40. end
  41. turtle.turnRight()
  42. end
  43. function down(distance)
  44. for i = 1,distance do
  45. turtle.down()
  46. end
  47. end
  48. function right(distance)
  49. turtle.turnRight()
  50. for i = 1,distance do
  51. turtle.forward()
  52. end
  53. turtle.turnLeft()
  54. end
  55. function payload(distance)
  56. redstone.setOutput("bottom", true)
  57. turtle.select(9)
  58. for i = 1,distance do
  59. turtle.placeDown()
  60. sleep(1)
  61. end
  62. redstone.setOutput("bottom", false)
  63. turtle.select(1)
  64. end
  65. while true do
  66. local id,msg,dist = rednet.receive()
  67. local command,dist = string.match(msg, "(%w+),(%w+)")
  68. if command == "forward" then
  69. forward(tonumber(dist))
  70. elseif command == "back" then
  71. back(tonumber(dist))
  72. elseif command == "dig" then
  73. mine(tonumber(dist))
  74. elseif command == "up" then
  75. up(tonumber(dist))
  76. elseif command == "down" then
  77. down(tonumber(dist))
  78. elseif command == "left" then
  79. left(tonumber(dist))
  80. elseif command == "right" then
  81. right(tonumber(dist))
  82. elseif command == "payload" then
  83. payload(tonumber(dist))
  84. elseif command == "lRight" then
  85. LookRight(tonumber(dist))
  86. elseif command == "lLeft" then
  87. LookLeft(tonumber(dist))
  88. end
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement