Advertisement
aharries

turtle_dig

Sep 6th, 2023 (edited)
1,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | Gaming | 0 0
  1. -- digHole.lua
  2.  
  3. -- Ask for dimensions
  4. -- print("Enter the width of the hole:")
  5. -- local width = tonumber(read())
  6. print("Enter the length of the hole:")
  7. local length = tonumber(read())
  8. -- print("Enter the depth of the hole:")
  9. -- local depth = tonumber(read())
  10.  
  11. -- Variables
  12. local start = 0
  13.  
  14. local function dropDown()
  15.   while not turtle.detectDown() do
  16.     turtle.down()
  17.   end
  18.   print("Reached the bottom.")
  19. end
  20.  
  21. local function digHole()
  22.   turtle.digDown()
  23.   start = start + 1
  24.   print(start)
  25. end
  26.  
  27. local function returnToStart()
  28.   for i = 0, start do
  29.     turtle.up()
  30.   end
  31. end
  32.  
  33. dropDown()
  34. digHole()
  35. returnToStart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement