Advertisement
enigma_0Z

Turtle DarkIron

Nov 25th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function goForward(nTimes, bBreak, bRetry)
  2.   local nTimes = nTimes or 1
  3.   local bBreak = bBreak or false
  4.   local bRetry = bRetry or true
  5.   for i = 1,nTimes do
  6.     if (bRetry) then
  7.       while not turtle.forward() do
  8.         if (bBreak) then
  9.           turtle.dig()
  10.           print("Digging")
  11.         end
  12.         print("Retrying forward movement")
  13.       end
  14.     else
  15.       if (not turtle.forward() and bBreak) then
  16.         turtle.dig()
  17.         turtle.forward()
  18.       end
  19.     end
  20.   end
  21. end
  22.  
  23. function turnRight(nTimes)
  24.   local nTimes = nTimes or 1
  25.   for i = 1,nTimes do
  26.     turtle.turnRight()
  27.   end
  28. end
  29.  
  30. function turnLeft(nTimes)
  31.   local nTimes = nTimes or 1
  32.   for i = 1,nTimes do
  33.     turtle.turnLeft()
  34.   end
  35. end
  36.  
  37. turtle.select(1)
  38. turtle.suckDown()
  39.  
  40. turnRight(2)
  41. goForward(2)
  42. turnLeft()
  43. goForward(3)
  44. turnLeft()
  45.  
  46. for i=1,turtle.getItemCount(1) do
  47.   turtle.select(1)
  48.   turtle.place()
  49.   sleep(2)
  50.  
  51.   turtle.select(2)
  52.   turtle.dig()
  53.   sleep(2)
  54. end
  55.  
  56. turnLeft()
  57. goForward(3)
  58. turnRight()
  59. goForward(2)
  60.  
  61. turtle.select(2)
  62. turtle.dropDown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement