Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function UP()
- while not(turtle.up()) do
- turtle.digUp()
- turtle.attackUp()
- end
- end
- function DOWN()
- while not(turtle.down()) do
- turtle.digDown()
- turtle.attackDown()
- end
- end
- function FORWARD()
- while not(turtle.forward()) do
- turtle.dig()
- turtle.attack()
- end
- end
- function Name()
- return turtle.getItemDetail().name
- end
- function Select(material)
- if pcall(Name) then
- if Name() == material then
- return true
- end
- end
- for i=1,16,1 do
- turtle.select(i)
- if pcall(Name) then
- if Name() == material then
- return true
- end
- end
- end
- write("Need more ")
- write(material)
- write("!")
- print("Press ENTER to continue...")
- read()
- return Select(material)
- end
- function BuildColoumnUp(y,material)
- for i=1,y,1 do
- UP()
- Select(material)
- turtle.placeDown()
- end
- FORWARD()
- DOWN()
- end
- function BuildColoumnDown(y,material)
- for i=1,y,1 do
- DOWN()
- Select(material)
- turtle.placeUp()
- end
- FORWARD()
- UP()
- end
- function BuildRow(x,y,material)
- if (x % 2 == 0) then
- for i=1,x/2,1 do
- BuildColoumnUp(y,material)
- BuildColoumnDown(y,material)
- end
- else
- for i=1,(x-1)/2,1 do
- BuildColoumnUp(y,material)
- BuildColoumnDown(y,material)
- end
- BuildColoumnUp(y,material)
- for i=2,y,1 do
- DOWN()
- end
- end
- end
- function BuildWalls(x,y,z,material)
- for i=0,1,1 do
- BuildRow(x,y,material)
- turtle.turnRight()
- FORWARD()
- BuildRow(z,y,material)
- turtle.turnRight()
- FORWARD()
- end
- end
- print("---------------------")
- write("Height: ")
- y = read()
- write("Length: ")
- x = read()
- write("Width: ")
- z = read()
- write("Material: ")
- material = read()
- print("Building....")
- BuildWalls(x,y,z,material)
- print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement