Advertisement
HoboEnderMan

1 wall

Nov 28th, 2020
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- uses hobo api t. ver 3.1.1
  2.  
  3. local height = 0
  4. local maxheight = 0
  5. local distance = 1
  6. local maxdistance = 0
  7.  
  8. print("This makes 1 wall")
  9. print("place the turtle on the floor of the start of the wall")
  10.  
  11. print("")
  12.  
  13. print("How tall should the wall be ?")
  14.  
  15. maxheight = tonumber(read())
  16.  
  17. print("How long Should the wall be")
  18.  
  19. maxdistance = tonumber(read())
  20.  
  21. print("The wall will be ".. maxheight.." blocks tall and " .. maxdistance.." blocks long")
  22.  
  23. local blockcount = maxheight * maxdistance
  24.  
  25. print("The wall needs "..blockcount.." blocks")
  26.  
  27. print("Make sure the turtle has fuel and the wall block is in slot 1")
  28.  
  29. print("Start Y/N")
  30.  
  31. local ready = read()
  32.  
  33. if ready ~= "y" and ready ~= "Y" then
  34.     return
  35.  
  36. end
  37.  
  38. select(1)
  39. local blockCount = turtle.getItemCount()
  40. local wallblock = turtle.getItemDetail()
  41.  
  42.  
  43. local selected = {}
  44. local function findBlock()
  45.  
  46.     for i = 1 , 16 do
  47.         turtle.select(i)
  48.         if turtle.getItemCount() ~= 0 then
  49.             selected = turtle.getItemDetail()
  50.             if selected.name == wallblock.name then
  51.                 blockCount = turtle.getItemCount()
  52.                 return
  53.             end
  54.         end
  55.     end
  56.  
  57. end
  58.  
  59.  
  60. local function WallUp()
  61.     t.up()
  62.     height = height + 1
  63.     if blockCount == 0 then
  64.         findBlock()
  65.     end
  66.     turtle.placeDown()
  67.     blockCount = blockCount - 1
  68.  
  69. end
  70.  
  71. -- start
  72.  
  73.  
  74. while distance ~= maxdistance do
  75.  
  76.     if height ~= maxheight then    
  77.         WallUp()
  78.        
  79.     else
  80.        
  81.         t.forward()
  82.         distance = distance + 1
  83.         while height ~= 0 do
  84.             t.down()
  85.             height = height - 1
  86.         end
  87.    
  88.     end
  89.  
  90. end
  91.  
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement