Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function startup()
- print("Enter width: ")
- xin = read()
- x = tonumber(xin)
- print("Enter length: ")
- zin = read()
- z = tonumber(zin)
- print("Up or down?")
- inupdown = read()
- print("Enter height: ")
- yin = read()
- y = tonumber(yin)
- turtle.select(1)
- turtle.refuel()
- return x, y, z, inupdown
- end
- function width(x)
- print(x)
- if x == 1 then
- print("Do nothing")
- else
- turtle.turnRight()
- for i = 2, x do
- if turtle.detect() then
- repeat
- turtle.dig()
- local success, digdig = turtle.detect()
- until(success == false)
- end
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = 2, x do
- turtle.forward()
- end
- turtle.turnRight()
- end
- end
- function length(z)
- if z == 1 then
- print("Do nothing")
- else
- if turtle.detect() then
- repeat
- turtle.dig()
- local success, digdig = turtle.detect()
- until(success == false)
- end
- turtle.forward()
- end
- end
- function height(y, inupdown)
- if y == 1 then
- print("Do nothing")
- elseif inupdown == "Up" or inupdown == "up" then
- turtle.digUp()
- turtle.up()
- elseif inupdown == "Down" or inupdown == "down" then
- turtle.digDown()
- turtle.down()
- end
- end
- function length_return(z)
- if z == 1 then
- print("Do nothing")
- else
- turtle.turnRight()
- turtle.turnRight()
- for i = 2, z do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- function height_return(y)
- if y == 1 then
- print("Do nothing")
- else
- for i = 2, y do
- turtle.down()
- end
- end
- end
- function main(x, y, z, inupdown)
- for h = 0, y - 1 do
- for i = 0, z - 1 do
- width(x)
- if i < z - 1 then
- length(z)
- end
- end
- if h < y - 1 then
- length_return(z)
- height(y, inupdown)
- end
- end
- height_return(y)
- end
- x, y, z, inupdown = startup()
- main(x, y, z, inupdown)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement