Guest User

Untitled

a guest
Feb 4th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. arg = {...}
  2.  
  3. length = arg[1]
  4. height = arg[2]
  5.  
  6. cSlot = 1
  7. slots = 16
  8. turtle.select(13)
  9. turtle.refuel()
  10. turtle.select(1)
  11.  
  12. if (length == nil or height == nil) then
  13. print ("Usage: wall <length> <heigth>")
  14. return
  15. end
  16.  
  17. function empty()
  18. if (turtle.getItemCount(slots) == 0) then
  19. print(string.format("I am empty. Please load more mats in slot %d to continue.", slots))
  20. while (turtle.getItemCount(slots) == 0 ) do
  21. sleep(1)
  22. end
  23. end
  24. if (turtle.getItemCount(cSlot) == 0) then
  25. cSlot = cSlot + 1
  26. turtle.select(cSlot)
  27. end
  28. end
  29.  
  30. function plcUp()
  31. if (turtle.detectUp()) then
  32. turtle.digUp()
  33. end
  34. turtle.placeUp()
  35. end
  36. function plcDown()
  37. if (turtle.detectDown()) then
  38. turtle.digDown()
  39. end
  40. turtle.placeDown()
  41. end
  42. function plcBehind()
  43. turtle.turnRight()
  44. turtle.turnRight()
  45. turtle.place()
  46. turtle.turnRight()
  47. turtle.turnRight()
  48. end
  49.  
  50. for i=0, (height/3-1), 1 do
  51. for j=1,(length - 1), 1 do
  52. empty()
  53. if (j>1) then
  54. plcBehind()
  55. end
  56. plcUp()
  57. plcDown()
  58. turtle.forward()
  59. end
  60. plcDown()
  61. plcBehind()
  62. turtle.up()
  63. plcDown()
  64. turtle.up()
  65. plcDown()
  66. turtle.up()
  67. turtle.turnRight()
  68. turtle.turnRight()
  69. end
  70. print("\nSurface complete.")
Add Comment
Please, Sign In to add comment