loccode

ComputerCraft Turtle Digger

Jan 17th, 2021
854
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Version 1.1")
  2. print("Skok dlinna?")
  3. length = read()
  4. print("Fakel kajdie skolko shagov stavit?")
  5. read_steps = read()
  6. steps = tonumber(read_steps)
  7. steps_saved = tonumber(read_steps)
  8. print("OK. Dlinna ustanovlena: ", length)
  9.  
  10. function digIt()
  11. turtle.dig()
  12. turtle.digDown()
  13. turtle.digUp()
  14. turtle.turnRight()
  15. turtle.dig()
  16. turtle.up()
  17. turtle.dig()
  18. turtle.down()
  19. turtle.down()
  20. turtle.dig()
  21. turtle.up()
  22. turtle.turnLeft()
  23. turtle.turnLeft()
  24. turtle.dig()
  25. turtle.up()
  26. turtle.dig()
  27. turtle.down()
  28. turtle.down()
  29. turtle.dig()
  30. turtle.up()
  31. turtle.turnRight()
  32. if steps < 1 then
  33. turtle.select(1)
  34. turtle.placeDown()
  35. turtle.forward()
  36. steps = steps_saved
  37. end
  38. turtle.forward()
  39. end
  40.  
  41. while tonumber(length) > 0 do
  42. turtle.turnLeft()
  43. turtle.turnLeft()
  44.  
  45. for i = 16,1,-1
  46. do
  47. print("Slot selected: ", i)
  48. turtle.select(i)
  49. item = turtle.getItemDetail(i)
  50.  
  51. if (item) then
  52. print(item.name)
  53.  
  54. if (item.name == "minecraft:cobblestone") then
  55.   turtle.drop(item.count)
  56.   print("Dropping cobblestone from slot: ", i)
  57.   print("Dropped amount: ", item.count)
  58.  
  59. else
  60. print("No stone in the slot: ", i)
  61. end
  62.  
  63. if (item.name == "minecraft:dirt") then
  64.   turtle.drop(item.count)
  65.   print("Dropping dirt from slot: ", i)
  66.   print("Dropped amount: ", item.count)
  67.  
  68. else
  69. print("No dirt in the slot: ", i)
  70. end
  71.  
  72. end
  73.  
  74. end
  75.  
  76.  
  77. turtle.turnRight()
  78. turtle.turnRight()
  79.  
  80. --Turtle digs
  81. digIt()
  82.  
  83.  --Turtle sets the fire
  84.  
  85.  
  86. --Turtle moving
  87. length = length - 1
  88. steps = steps - 1
  89. print(steps)
  90.  
  91.  
  92. end
RAW Paste Data