Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function digU()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- function digF()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function digD()
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- function goU()
- repeat
- digU()
- proofFuel()
- until turtle.up()
- end
- function goF()
- repeat
- digF()
- proofFuel()
- until turtle.forward()
- end
- function goD()
- repeat
- digD()
- proofFuel()
- until turtle.down()
- end
- function status()
- term.clear()
- term.setCursorPos(1,1)
- print("Build wall:")
- print("")
- if wall then
- print("H:"..other.." L:"..length)
- else
- print("W:"..other.." L:"..length)
- end
- print("")
- print(set.."/"..blocks.." set, "..(blocks-set).." left.")
- end
- function proofFuel()
- if turtle.getFuelLevel()==0 then
- turtle.select(16)
- while turtle.refuel(1)==false do
- term.clear()
- term.setCursorPos(1,1)
- print("Build wall:")
- print("")
- print("Put coal on slot 16.")
- os.sleep(4)
- turtle.select(16)
- end
- turtle.select(1)
- end
- end
- function place()
- local showFillMsg=true
- while true do
- digF()
- if turtle.getItemCount(1)>1 then
- if turtle.place() then
- return
- end
- else
- for i=2,15 do
- if turtle.compareTo(i) then
- turtle.select(i)
- if turtle.place() then
- turtle.select(1)
- return
- end
- break
- end
- end
- end
- if showFillMsg then
- term.clear()
- term.setCursorPos(1,1)
- print("Build wall:")
- print("")
- print("Put building blocks on slot 1.")
- print("Fill turtle with more of them.")
- showFillMsg=false
- end
- os.sleep(4)
- end
- end
- turtle.select(1)
- term.clear()
- term.setCursorPos(1,1)
- print("Build wall:")
- print("")
- print("Put building blocks on slot 1")
- print("Fill turtle with more of them.")
- print("Put coal on slot 16.")
- print("Wall/Bottom (w/b):")
- term.setCursorPos(20,6)
- if read()=="w" then
- term.setCursorPos(20,6)
- print("Wall")
- wall=true
- else
- term.setCursorPos(20,6)
- print("Bottom")
- wall=false
- end
- term.setCursorPos(1,7)
- if wall then
- print("Height:")
- repeat
- term.setCursorPos(9,7)
- print(" ")
- term.setCursorPos(9,7)
- other=tonumber(read())
- until other>0
- else
- print("Width:")
- repeat
- term.setCursorPos(8,7)
- print(" ")
- term.setCursorPos(8,7)
- other=tonumber(read())
- until other>0
- end
- term.setCursorPos(1,8)
- print("Length:")
- repeat
- term.setCursorPos(9,8)
- print(" ")
- term.setCursorPos(9,8)
- length=tonumber(read())
- until length>0
- blocks=length*other
- set=0
- pos=0
- for i=2,length do
- goF()
- end
- for iL=1,length do
- place()
- set=set+1
- status()
- for iO=2,other do
- if wall then
- if pos==0 then
- goU()
- else
- goD()
- end
- else
- if pos==0 then
- turtle.turnRight()
- goF()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- goF()
- turtle.turnRight()
- end
- end
- place()
- set=set+1
- status()
- end
- if iL~=length then
- turtle.turnLeft()
- turtle.turnLeft()
- goF()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- pos=(pos*-1)+1
- end
- if other>1 then
- if pos==1 then
- if wall then
- for i=2,other do
- goD()
- end
- else
- turtle.turnLeft()
- for i=2,other do
- goF()
- end
- turtle.turnRight()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment