Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refuel()
- if turtle.getFuelLevel()==0 then
- a = turtle.getSelectedSlot()
- turtle.select(16)
- while turtle.refuel(5)==false do
- term.write("Please refuel me!!")
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- end
- turtle.select(a)
- end
- end
- function forward()
- while turtle.forward()==false do
- turtle.dig()
- refuel()
- end
- end
- function up()
- while turtle.up()==false do
- turtle.digUp()
- refuel()
- end
- end
- function down()
- while turtle.down()==false do
- turtle.digDown()
- refuel()
- end
- end
- function around()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function selection()
- for i = 1, 14 do
- turtle.select(i)
- if turtle.compareTo(15)==true then
- break
- end
- if i==14 then
- while turtle.compareTo(15)==false do
- turtle.select(1)
- print("Please give me some more blocks")
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- end
- end
- end
- end
- function dig()
- while turtle.detect()==true do
- turtle.dig()
- end
- end
- --Main program
- term.clear()
- term.setCursorPos(1, 1)
- term.write("How wide should the room be ? ")
- y = read()
- print(y)
- term.write("How deep should the room be? ")
- d = read()
- term.write("How high should the room be ? ")
- c = read()
- x = d-1
- z = c-1
- term.clear()
- term.setCursorPos(1, 1)
- print("Work in progress..")
- for k= 1, y do
- for j= 1, z do
- for i= 1, x do
- print(y)
- if j==1 then
- selection()
- turtle.digDown()
- turtle.placeDown()
- end
- if j==z then
- while turtle.detectUp()==true do
- turtle.digUp()
- end
- selection()
- turtle.placeUp()
- end
- if i==1 then
- around()
- dig()
- selection()
- turtle.place()
- around()
- end
- if k==1 then
- if j%2==0 then
- turtle.turnRight()
- dig()
- selection()
- turtle.place()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- dig()
- selection()
- turtle.place()
- turtle.turnRight()
- end
- end
- if k==y then
- if j%2==0 then
- turtle.turnLeft()
- dig()
- selection()
- turtle.place()
- turtle.turnRight()
- else
- turtle.turnRight()
- dig()
- selection()
- turtle.place()
- turtle.turnLeft()
- end
- end
- forward()
- if i==x then
- if k==1 then
- if j%2==0 then
- turtle.turnRight()
- dig()
- selection()
- turtle.place()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- dig()
- selection()
- turtle.place()
- turtle.turnRight()
- end
- end
- if k==y then
- if j%2==0 then
- turtle.turnLeft()
- dig()
- selection()
- turtle.place()
- turtle.turnRight()
- else
- turtle.turnRight()
- dig()
- selection()
- turtle.place()
- turtle.turnLeft()
- end
- end
- dig()
- selection()
- turtle.place()
- end
- end
- if j==1 then
- turtle.digDown()
- selection()
- turtle.placeDown()
- end
- up()
- around()
- end
- for i = 1, x do
- if i==1 then
- around()
- dig()
- selection()
- turtle.place()
- around()
- end
- while turtle.detectUp()==true do
- turtle.digUp()
- end
- selection()
- turtle.placeUp()
- if k==1 then
- if c%2==0 then
- turtle.turnRight()
- selection()
- dig()
- turtle.place()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- dig()
- selection()
- turtle.place()
- turtle.turnRight()
- end
- end
- forward()
- if k==1 then
- if i==x then
- if c%2==0 then
- turtle.turnRight()
- dig()
- selection()
- turtle.place()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- dig()
- selection()
- turtle.place()
- turtle.turnRight()
- end
- end
- end
- if i==x then
- dig()
- selection()
- turtle.place()
- end
- end
- while turtle.detectUp()==true do
- turtle.digUp()
- end
- selection()
- turtle.placeUp()
- if c%2==0 then
- for i = 1, z do
- down()
- end
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- else
- around()
- for i = 1, x do
- turtle.forward()
- end
- for i = 1, z do
- down()
- end
- turtle.turnLeft()
- if k ~= y then
- forward()
- end
- turtle.turnLeft()
- end
- end
- --term.clear()
- term.setCursorPos(1, 1)
- print("Work is done!")
Advertisement
Add Comment
Please, Sign In to add comment