Guest User

Untitled

a guest
May 27th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. print( "Hello! I can make a platform, say you need a floor or a roof or just a flat surface I can do it" )
  2. print( "Push any key to continue" )
  3. os.pullEvent( "key" )
  4. term.clear()
  5. term.setCursorPos(1, 1)
  6.  
  7. print( "Place me in the bottom left corner that you would like to be your platform." )
  8. print( "Push any key to continue" )
  9. os.pullEvent( "key" )
  10. term.clear()
  11. term.setCursorPos(1, 1)
  12.  
  13. print( "How long would you like the first side to be? This will be the first length" )
  14. local a = io.read()
  15. local length = tonumber( a )
  16. term.clear()
  17. term.setCursorPos(1, 1)
  18.  
  19. print( "How long would you like the width to be?" )
  20. local b = io.read()
  21. local width = tonumber( b )
  22. term.clear()
  23. term.setCursorPos(1, 1)
  24.  
  25. local counterLength = 1
  26. local counterWidth = 1
  27. local inventory = 1,9
  28. local direction = 0
  29.  
  30. local function floor()
  31. turtle.digDown()
  32. turtle.placeDown()
  33. counterLength = counterLength + 1
  34. turtle.forward()
  35. end
  36.  
  37.  
  38. while true do
  39. print( "Building..." )
  40. while turtle.getItemCount( inventory ) == 0 do
  41. print( "I ran out of blocks... Can I have some more? Press a key when ready" )
  42. os.pullEvent( "key" )
  43. end
  44.  
  45. floor()
  46.  
  47.  
  48. if counterLength == length then
  49. if direction == 0 then
  50. turtle.digDown()
  51. turtle.placeDown()
  52. turtle.turnRight()
  53. turtle.forward()
  54. turtle.turnRight()
  55. direction = 1
  56. counterLength = 1
  57. counterWidth = counterWidth +1
  58. end
  59.  
  60.  
  61. end
  62.  
  63. if counterLength == length then
  64. if direction == 1 then
  65. turtle.digDown()
  66. turtle.placeDown()
  67. turtle.turnLeft()
  68. turtle.forward()
  69. turtle.turnLeft()
  70. direction = 0
  71. counterLength = 1
  72. counterWidth = counterWidth +1
  73. end
  74.  
  75.  
  76.  
  77. end
  78.  
  79. if counterWidth == width + 1 then
  80. term.clear()
  81. term.setCursorPos()
  82. print( "Platform is complete!" )
  83. os.pullEvent( "key" )
  84. startup()
  85. end
  86.  
  87.  
  88.  
  89. end
Add Comment
Please, Sign In to add comment