Guest User

replace

a guest
Apr 6th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. function replacedown()
  2.   turtle.select(1)
  3.   turtle.digDown()
  4.   turtle.placeDown()
  5.   turtle.forward()
  6. end
  7.  
  8. x = 2
  9.  
  10. function leftcontinue()
  11.   turtle.turnLeft()
  12.   turtle.forward()
  13.   turtle.turnLeft()
  14.   turtle.forward()
  15. end
  16.  
  17. function refill()
  18.   if turtle.getItemCount(1) < 1 then
  19.   turtle.select(3)
  20.   turtle.place()
  21.   turtle.select(1)
  22.   turtle.suck()
  23.   turtle.select(3)
  24.   turtle.dig()
  25.   turtle.select(1)
  26. end
  27. end
  28.  
  29. function rightcontinue()
  30.   turtle.turnRight()
  31.   turtle.forward()
  32.   turtle.turnRight()
  33.   turtle.forward()
  34. end
  35.  
  36. function continue()
  37.   if x%2 then leftcontinue() x=x+1 return "x"
  38.   else rightcontinue() x=x+1 return "x"
  39. end
  40. end
  41.  
  42. function main()
  43.   turtle.select(2)
  44.   if turtle.compareDown() == true then continue()
  45.   else replacedown()
  46.   refill()
  47.  end
  48. end
  49.  
  50. while true do
  51. main()
  52.  
  53. end
Advertisement
Add Comment
Please, Sign In to add comment