Advertisement
Guest User

test

a guest
Oct 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. local tArgs = {...}
  2. if #tArgs ~= 3 then
  3. print("Requires length, width, height")
  4. return
  5. end
  6.  
  7. local x = tonumber(tArgs[1]) - 1
  8. local y = tonumber(tArgs[2])
  9. local z = tonumber(tArgs[3])
  10.  
  11. if x == nil or y == nil or z == nil then
  12. print("Invalid dimensions")
  13. return
  14. end
  15.  
  16. if x < 0 or y < 0 or z < 0 then
  17. print("Invalid (negative) dimensions")
  18. return
  19. end
  20.  
  21.  
  22.  
  23. local direction = true
  24. for i = 1, z do
  25. for j = 1, y do
  26. for k = 1, x do
  27. turtle.dig()
  28. turtle.forward()
  29. end
  30. if j < y then
  31. if direction then
  32. turtle.turnRight()
  33. turtle.dig()
  34. turtle.forward()
  35. turtle.turnRight()
  36. direction = false
  37. else
  38. turtle.turnLeft()
  39. turtle.dig()
  40. turtle.forward()
  41. turtle.turnLeft()
  42. direction = true
  43. end
  44. end
  45. end
  46. if i < z then
  47. turtle.digUp()
  48. turtle.up()
  49. turtle.turnRight()
  50. turtle.turnRight()
  51. end
  52. end
  53.  
  54. if y % 2 == 0 then
  55. turtle.turnRight()
  56. for i = 1, y do
  57. turtle.forward()
  58. end
  59. turtle.turnRight()
  60. else
  61. turtle.turnLeft()
  62. for i = 1, y do
  63. turtle.forward()
  64. end
  65. turtle.turnLeft()
  66. for i = 1, x do
  67. turtle.forward()
  68. end
  69. turtle.turnRight()
  70. turtle.turnRight()
  71. end
  72. for i = 1, z do
  73. turtle.down()
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement