Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function stopProgram()
- print("(Hold Ctrl+T to end program.)")
- end
- function askLWD()
- print("Enter numerical values that are greater than one for the following.")
- write("Lenght: ") L = tonumber(read())
- write("Width : ") W = tonumber(read())
- write("Depth : ") D = tonumber(read())
- end
- function digDepth()
- if width % 2 == 0 then
- while turtle.detectUp() do
- turtle.digUp()
- os.sleep(.5)
- end
- if depth ~= D then
- turtle.up()
- else
- end
- else
- while turtle.detectDown() do
- turtle.digDown()
- end
- if depth ~= D then
- turtle.down()
- else
- end
- end
- end
- function digRight()
- if width ~= W then
- turtle.turnRight()
- while turtle.detect() do
- turtle.dig()
- os.sleep(.5)
- end
- turtle.forward()
- turtle.turnLeft()
- else
- while turtle.detect() do
- turtle.dig()
- os.sleep(.5)
- end
- turtle.forward()
- end
- end
- function digLeft()
- if width ~= W then
- turtle.turnLeft()
- while turtle.detect() do
- turtle.dig()
- os.sleep(.5)
- end
- turtle.forward()
- turtle.turnRight()
- else
- while turtle.detect() do
- turtle.dig()
- os.sleep(.5)
- end
- turtle.forward()
- end
- end
- clear()
- stopProgram()
- print("Place the turtle 'IN THE BLOCK' that is top left corner of the room facing the direction that will be the lenght of the room.")
- print("Press enter to continue...")
- read()
- clear()
- stopProgram()
- askLWD()
- while type(L) ~= "number" or type(W) ~= "number" or type(D) ~= "number" do
- clear()
- stopProgram()
- print("Error... You must enter a valid number greater than zero for all 3 values.")
- askLWD()
- end
- print("The room will be "..L.." in lenght,"..W.." in width &"..D.."in depth.")
- print("Press enter to begin creating room.")
- stopProgram()
- read()
- for lenght = 1, L do
- for width = 1, W do
- for depth = 1, D-1 do
- digDepth()
- end
- if lenght % 2 == 0 then
- digLeft()
- else
- digRight()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement