Advertisement
Guest User

platform

a guest
Aug 1st, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 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,15
  28. local direction = 0
  29. local slot = 1
  30.  
  31. local function floor()
  32.  turtle.digDown()
  33.   turtle.placeDown()
  34.    counterLength = counterLength + 1
  35.     turtle.forward()
  36. end
  37.    
  38.  
  39. while true do
  40.  print( "Building..." )
  41.  
  42.  while turtle.getItemCount(slot) == 0 do
  43.  for i=1,15 do
  44.   slot = i
  45.   turtle.select(i)
  46.  if turtle.compareTo(16) == true
  47.  then break
  48.  else
  49.  turtle.drop()
  50.  end
  51. end
  52. if turtle.getItemCount(slot) == 0 then
  53.  
  54.   print( "I ran out of blocks... Can I have some more? Press a key when ready" )
  55.    os.pullEvent( "key" )
  56. else
  57. end
  58. end
  59.  floor()
  60.  
  61.  
  62.  if counterLength == length then
  63.   if direction == 0 then
  64.    turtle.digDown()
  65.     turtle.placeDown()
  66.      turtle.turnRight()
  67.       turtle.forward()
  68.        turtle.turnRight()
  69.          direction = 1
  70.           counterLength = 1
  71.            counterWidth = counterWidth +1
  72.     end
  73.  
  74.        
  75. end
  76.  
  77.   if counterLength == length then
  78.      if direction == 1 then
  79.          turtle.digDown()
  80.           turtle.placeDown()
  81.            turtle.turnLeft()
  82.             turtle.forward()
  83.              turtle.turnLeft()
  84.               direction = 0
  85.                counterLength = 1
  86.                 counterWidth = counterWidth +1
  87.       end
  88.    
  89.  
  90.        
  91. end
  92.  
  93.    if counterWidth == width + 1 then
  94.     term.clear()
  95.     term.setCursorPos()
  96.     print( "Platform is complete!" )
  97.      os.pullEvent( "key" )
  98.       startup()
  99.    end
  100.    
  101.  
  102.    
  103.    end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement