function Save(file, data) io.output("Saves/"..file) io.write(data) io.close() end function Read(file) io.input("Saves/"..file) i = tonumber(io.read()) return i end function InventoryFull() for **1, 16 do turtle.select(i) if turtle.getItemCount() == 0 then return false end end return true end function Empty() for **1, 16 do turtle.select(i) full = turtle.drop() if full == false then return full break end end end function TurnDirection(direction, turns) io.input("Saves/direction") if direction == "right" then i = io.read() + turns while i > 4 do i = i-4 end else i = io.read() - turns while i < 1 do i = i+4 end end Save("direction", i) return(i) end function MoveHorizontal(len, directionStr, breakmode) currDirection = Read("direction") finaldirection = currDirection direction = tonumber(directionStr) if direction > currDirection then turns = direction - currDirection for **1,turns,1 do turtle.turnRight() end finaldirection = TurnDirection("right", turns) elseif direction < currDirection then turns = currDirection - direction for **1,turns,1 do turtle.turnLeft() end finaldirection = TurnDirection("left", turns) end moved = 0 for **1,len do while turtle.detect() == true do if breakmode == true then turtle.dig() else break end end turtle.forward() moved = moved+1 end if finaldirection == 1 then Save("z", Read("z")-moved) elseif finaldirection == 2 then Save("x", Read("x")+moved) elseif finaldirection == 3 then Save("z", Read("z")+moved) elseif finaldirection == 4 then Save("x", Read("x")-moved) end end function MoveVertical(len, direction, breakmode) if direction == "up" then moved = 0 for **1,len do while turtle.detectUp() == true do if breakmode == true then turtle.digUp() else break end end turtle.up() moved = moved+1 end Save("y", Read("y")+moved) elseif direction == "down" then moved = 0 for **1,len do while turtle.detectDown() == true do if breakmode == true then turtle.digDown() else break end end turtle.down() moved = moved+1 end Save("y", Read("y")-moved) end end --Startup print("Set Location?") print("1. Yes") print("2. No") if read() == "1" then print("X Location") local xCoordinate = read() Save("x", xCoordinate) print("Y Location") local yCoordinate = read() Save("y", yCoordinate) print("Z Location") local zCoordinate = read() Save("z", zCoordinate) print("Direction Facing") local direction = read() Save("direction", direction) end --Main print(Empty())