Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- GUI = tArgs[1]
- directions = tArgs[1]
- times = tArgs[2]
- turns = 0
- turn = 0
- slot = 1
- x = 0
- y = 0
- z = 0
- function forward()
- if not turtle.forward() then
- turtle.dig()
- forward()
- end
- end
- function checkInv()
- while true do
- if slot <= 16 then
- if turtle.getItemCount(slot) > 0 then
- turtle.select(slot)
- break
- else
- slot = slot + 1
- end
- else
- print("out")
- return false
- end
- end
- end
- function right()
- for i = 1, times - 1 do
- turtle.place()
- turtle.turnRight()
- forward()
- turtle.turnLeft()
- print("Moves: "..turns)
- end
- turtle.place()
- end
- function left()
- for i = 1, times - 1 do
- turtle.place()
- turtle.turnLeft()
- forward()
- turtle.turnRight()
- turns = turns + 1
- print("Moves: "..turns)
- end
- turtle.place()
- end
- function wall()
- term.clear()
- term.setCursorPos(1,1)
- print("How high do you want it?")
- high = read()
- high = tonumber(high)
- term.clear()
- term.setCursorPos(1,1)
- print("How long do you want it?")
- times = read()
- term.clear()
- term.setCursorPos(1,1)
- guiRight()
- if direction == "right" then
- while turn < high do
- right()
- turtle.up()
- turn = turn + 1
- if turn < high then
- left()
- turtle.up()
- turn = turn + 1
- end
- end
- elseif direction == "left" then
- while turn < high do
- left()
- turtle.up()
- turn = turn + 1
- if turn < high then
- right()
- turtle.up()
- turn = turn + 1
- end
- end
- end
- end
- function ground()
- term.clear()
- term.setCursorPos(1,1)
- print("How deep do you want it?")
- deep = read()
- term.clear()
- term.setCursorPos(1,1)
- print("How wide do you want it?")
- wide = read()
- wide = tonumber(wide)
- term.clear()
- term.setCursorPos(1,1)
- guiRight()
- if direction == "right" then
- while turn < wide do
- for i = 1, deep - 1 do
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- forward()
- y = y + 1
- end
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- turtle.turnRight()
- forward()
- x = x + 1
- turtle.turnRight()
- turn = turn + 1
- if turn < wide then
- for i = 1, deep - 1 do
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- forward()
- y = y - 1
- end
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- turtle.turnLeft()
- forward()
- x = x + 1
- turtle.turnLeft()
- turn = turn + 1
- end
- end
- elseif direction == "left" then
- while turn < wide do
- for i = 1, deep - 1 do
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- forward()
- y = y + 1
- end
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- turtle.turnLeft()
- forward()
- x = x + 1
- turtle.turnLeft()
- turn = turn + 1
- if turn < wide then
- for i = 1, deep - 1 do
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- forward()
- y = y - 1
- end
- if checkInv() then
- break
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.digUp()
- turtle.placeDown()
- end
- turtle.turnRight()
- forward()
- x = x + 1
- turtle.turnRight()
- turn = turn + 1
- end
- end
- end
- end
- function guiRight()
- term.clear()
- term.setCursorPos(1,1)
- print("What direction do you want it?")
- print(">Right<")
- term.setCursorPos(10,2)
- print("Left")
- event, param = os.pullEvent("key")
- key = keys.getName(param)
- if key == "enter" then
- direction = "right"
- elseif key == "right" then
- guiLeft()
- else
- guiRight()
- end
- end
- function guiLeft()
- term.clear()
- term.setCursorPos(1,1)
- print("What direction do you want it?")
- print("Right")
- term.setCursorPos(10,2)
- print(">Left<")
- event, param = os.pullEvent("key")
- key = keys.getName(param)
- if key == "enter" then
- direction = "left"
- elseif key == "left" then
- guiRight()
- else
- guiLeft()
- end
- end
- function guiWall()
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome, How may I help you.")
- term.setCursorPos(4,3)
- print(">Wall<")
- term.setCursorPos(14,3)
- print("Floor")
- term.setCursorPos(4,5)
- print("Stair")
- term.setCursorPos(14,5)
- print("")
- event, param = os.pullEvent("key")
- key = keys.getName(param)
- if key == "enter" then
- wall()
- elseif key == "right" then
- guiFloor()
- elseif key == "down" then
- guiStair()
- else
- guiWall()
- end
- end
- function guiStair()
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome, How may I help you.")
- term.setCursorPos(4,3)
- print("Wall")
- term.setCursorPos(14,3)
- print("Floor")
- term.setCursorPos(4,5)
- print(">Stair<")
- term.setCursorPos(14,5)
- print("")
- event, param = os.pullEvent("key")
- key = keys.getName(param)
- if key == "enter" then
- wall()
- elseif ey == "right" then
- guiFloor()
- elseif key == "up" then
- guiWall()
- else
- guiStair()
- end
- end
- function guiFloor()
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome, How may I help you.")
- term.setCursorPos(4,3)
- print("Wall")
- term.setCursorPos(14,3)
- print(">Floor<")
- term.setCursorPos(4,5)
- print("Stair")
- term.setCursorPos(14,5)
- print("")
- event, param = os.pullEvent("key")
- key = keys.getName(param)
- if key == "enter" then
- ground()
- elseif key == "left" then
- guiWall()
- elseif key == "down" then
- guiStair()
- else
- guiFloor()
- end
- end
- function home()
- print("Out of resources")
- end
- --Main running code
- if GUI == "gui" then
- guiWall()
- elseif directions == "right" then
- right()
- elseif directions == "left" then
- left()
- else
- print("Usage: roof direction times")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement