Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------Written by Barnet-----------
- function MoveUp()
- while turtle.up() == false do
- if turtle.detectUp() == true then
- turtle.digUp()
- else
- turtle.attackUp()
- end
- end
- end
- function MoveDown()
- while turtle.down() == false do
- if turtle.detectDown() == true then
- turtle.digDown()
- else
- turtle.attackDown()
- end
- end
- end
- function CheckSlot()
- Slot = turtle.getItemDetail()
- if Slot.name == "" then
- return true
- else
- return false
- end
- end
- function CheckMaterial(Material)
- Item = turtle.getItemDetail()
- if pcall(CheckSlot) == true then
- if Item.name == Material then
- return true
- else
- return false
- end
- else
- return false
- end
- end
- function Refill(Material)
- if CheckMaterial(Material) == false then
- c = 1
- while c<17 do
- turtle.select(c)
- c=c+1
- if CheckMaterial(Material) == true then
- c=17
- elseif c == 17 then
- turtle.select(1)
- print("Missing material!")
- error()
- end
- end
- end
- end
- function MoveForward()
- while turtle.forward() == false do
- if turtle.detect() == true then
- turtle.dig()
- else
- turtle.attack()
- end
- end
- end
- function BuildUp(y,Material)
- x = 0
- while x<y do
- Refill(Material)
- MoveUp()
- turtle.placeDown()
- x=x+1
- end
- MoveForward()
- MoveDown()
- x = 1
- while x<y do
- Refill(Material)
- MoveDown()
- turtle.placeUp()
- x=x+1
- end
- Refill(Material)
- MoveForward()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function Build(y,z,Material)
- v = 1
- while v<=z/2 do
- BuildUp(y,Material)
- v=v+1
- end
- end
- print()
- print("Build a Wall")
- print("---------------------------------------")
- write("Height: ")
- y = tonumber(read())
- write("Length: ")
- z = tonumber(read())
- write("Material: ")
- Material = read()
- print("Building wall....")
- Build(y,z,Material)
- print("Done!")
Add Comment
Please, Sign In to add comment