Advertisement
argaman

Untitled

Jun 16th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. --stairs
  2.  
  3. function moveLeft(blocks)
  4. turtle.turnLeft()
  5. for i=1,blocks do
  6. turtle.forward()
  7. end
  8. turtle.turnRight()
  9. end
  10.  
  11. function moveRight(blocks)
  12. turtle.turnRight()
  13. for i=1,blocks do
  14. turtle.forward()
  15. end
  16. turtle.turnLeft()
  17. end
  18.  
  19. function moveUp(blocks)
  20. for i=1,blocks do
  21. turtle.up()
  22. end
  23. end
  24.  
  25. function moveForward(blocks)
  26. for i=1,blocks do
  27. turtle.forward()
  28. end
  29. end
  30.  
  31. function buildSide(height, amount)
  32. for i=1,height do
  33. for j=1,amount do
  34. turtle.place()
  35. moveLeft(1)
  36. end
  37. moveRight(amount)
  38. moveUp(1)
  39. moveForward(1)
  40. end
  41. end
  42.  
  43. function ready(amount)
  44. turtle.forward()
  45. turtle.turnLeft()
  46. for i=1,amount-1 do
  47. turtle.forward()
  48. end
  49. end
  50.  
  51. function main(amount, width, length, height)
  52. for i=1,height,2 do
  53. buildSide(width, amount)
  54. ready(amount)
  55. buildSide(length, amount)
  56. ready(amount)
  57. end
  58. end
  59.  
  60. print("amount")
  61. local amount = tonumber(read())
  62. print("width")
  63. local width = tonumber(read())
  64. print("length")
  65. local length = tonumber(read())
  66. print("height")
  67. local height = tonumber(read())
  68.  
  69. print("amount="..amount)
  70. print("width="..width)
  71. print("length="..length)
  72. print("height="..height)
  73.  
  74. main(amount, width, length, height)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement