Niseg

test room builder

Feb 27th, 2013
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. -- build a room to the left then descends
  2. print("first wall?")
  3. local x=tonumber(read())
  4. print("second wall?")
  5. local y=tonumber(read())
  6. print("height?")
  7. local z=tonumber(read())
  8. local count=0
  9. local slot =1
  10.  
  11. function ensureSlot()
  12. if count==0 then
  13. slot=slot+1;
  14. count=turtle.getItemCount(slot)
  15. if count==0 then exit() end
  16. turtle.select(slot)
  17. end
  18. end
  19.  
  20. count=turtle.getItemCount(slot)
  21. turtle.turnRight();turtle.turnRight();
  22. for k=1,z-1 do
  23. turtle.up()
  24. for j=1,2 do
  25. for i=1,x-2 do
  26. turtle.placeDown()
  27. turtle.back()
  28. count=count-1;ensureSlot()
  29. end
  30. turtle.placeDown()
  31. count=count-1;ensureSlot()
  32. turtle.turnLeft()
  33. turtle.back()
  34. for i=1,y-2 do
  35. turtle.placeDown()
  36. turtle.back()
  37. count=count-1;ensureSlot()
  38. end
  39. turtle.placeDown()
  40. count=count-1;ensureSlot()
  41. turtle.turnLeft()
  42. turtle.back()
  43.  
  44. end
  45. end
  46. turtle.forward()
  47. turtle.up()
  48. for j=1,y do
  49. for i=1,x-1 do
  50.  
  51. turtle.placeDown()
  52. count=count-1;ensureSlot()
  53. turtle.back()
  54. end
  55. turtle.placeDown()
  56. count=count-1;ensureSlot()
  57. if(j%2== 1) then turtle.turnLeft() else turtle.turnRight() end
  58. turtle.back()
  59.  
  60. if(j%2== 1) then turtle.turnLeft() else turtle.turnRight() end
  61. --turtle.back()
  62.  
  63. end
  64. for k=1,z do turtle.down() end
Advertisement
Add Comment
Please, Sign In to add comment