Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- answer = "not yes"
- i = 1
- print("If you wish to build a wall and not a 4 sided room enter the width as wall. The smallest room this program can make is 3 x 3.")
- while answer ~= "yes" do
- answer = "not yes"
- write("Enter the height: ")
- h = read()
- write("Enter the length: ")
- l = read()
- write("Enter the width: ")
- w = read()
- print("You entered your height as ", h," your length as ", l," and your width as ", w,".")
- print("Is this correct?")
- if w ~= "wall" then
- while (answer ~= "yes") and (answer ~= "no") do
- answer = read()
- if answer == "yes" then
- print("This room will cost about ", l*h*2+w*h*2-4*h," blocks.")
- elseif answer == "no" then
- print("Please try again.")
- else
- print("I don't understand ", answer,". Please enter yes or no.")
- end
- end
- else
- while (answer ~= "yes") and (answer ~= "no") do
- answer = read()
- if answer == "yes" then
- print("Wall will cost about ", h*l," blocks.")
- elseif answer == "no" then
- print("Please try again.")
- else
- print("I don't understand ", answer,". Please enter yes or no")
- end
- end
- end
- end
- local function adjust()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- local function reset()
- turtle.turnRight()
- turtle.back()
- turtle.back()
- end
- local function checkSlot()
- while turtle.getItemCount() == 0 do
- turtle.select(i)
- i = i + 1
- if i > 16 then
- i = 1
- end
- end
- return true
- end
- local function makeSide()
- for j = 1, h, 1 do
- if checkSlot() then
- turtle.place()
- turtle.up()
- end
- end
- adjust()
- h = 0
- while turtle.down() do
- h = h + 1
- end
- end
- for n = 1, l, 1 do
- makeSide()
- end
- if w == "wall" then
- print("Completed Wall")
- else
- reset()
- for n = 1, w-1, 1 do
- makeSide()
- end
- reset()
- for n = 1, l-1, 1 do
- makeSide()
- end
- reset()
- for n = 1, w-2, 1 do
- makeSide()
- end
- print("Completed Room")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement