dragonbabyfly

Dragonfarm Turtle

Dec 28th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. modem = peripheral.wrap("left")
  2. modem.open(999)
  3.  
  4. function Forward(Dist)
  5. for i = 1, Dist do
  6. turtle.forward()
  7. end
  8. end
  9.  
  10. function Back(Dist)
  11. for i = 1, Dist do
  12. turtle.forward()
  13. end
  14. end
  15.  
  16. function Turn(Dir, Times)
  17. if Dir == "left" then
  18. for i = 1, Times do
  19. turtle.turnLeft()
  20. end
  21. elseif Dir == "right" then
  22. for i = 1, Times do
  23. turtle.turnRight()
  24. end
  25. end
  26. end
  27.  
  28. function Up(Dist)
  29. for i = 1, Dist do
  30. turtle.up()
  31. end
  32. end
  33.  
  34. function Down(Dist)
  35. for i = 1, Dist do
  36. turtle.down()
  37. end
  38. end
  39.  
  40. function PlaceDown(Slot)
  41. turtle.select(Slot)
  42. turtle.placeDown()
  43. end
  44.  
  45. function Take(Slot, Amount)
  46. turtle.select(Slot)
  47. turtle.suck(Amount)
  48. end
  49.  
  50. function GetStone()
  51. Turn("left",2)
  52. Take(1,1)
  53. Turn("right",2)
  54. end
  55.  
  56. function PlaceStone()
  57. Up(1)
  58. Forward(5)
  59. Turn("left",1)
  60. Forward(1)
  61. PlaceDown(1)
  62. Turn("left",2)
  63. Forward(1)
  64. Turn("right",1)
  65. Forward(5)
  66. Down(1)
  67. Turn("left",2)
  68. end
  69.  
  70. function Cycle()
  71. GetStone()
  72. PlaceStone()
  73. end
  74.  
  75. while true do
  76. event, _, _, _, message, _ = os.pullEvent("modem_message")
  77. if message == "Place" then
  78. Cycle()
  79. end
  80. end
Add Comment
Please, Sign In to add comment