local Length local Width local Forward = 0 local Right = 0 local Slot_selected = 1 local turn = "left" local dia = 0 local iron = 0 local copper = 0 local gold = 0 local silver = 0 local coal = 0 local tin = 0 local lapis = 0 local emerald = 0 local ruby = 0 local sapphire = 0 local peridot = 0 local redstone = 0 local exploration = 0 term.write("Insert Length: ") Length = tonumber(read()) - 1 print(" ") term.write("Insert Width: ") Width = tonumber(read()) print(" ") function dig() turtle.digDown() if turtle.forward() == false then while turtle.forward() == false do turtle.dig() end Forward = Forward + 1 else Forward = Forward + 1 end check_ore() throw_away() turtle.digDown() end function digBack() turtle.digDown() if turtle.forward() == false then while turtle.forward() == false do turtle.dig() end Forward = Forward - 1 else Forward = Forward - 1 end check_ore() throw_away() turtle.digDown() end function check_ore() if turtle.getItemCount(Slot_selected) > 0 then local x, y, z = gps.locate(5) x = math.floor(x) y = math.floor(y) local item_detail = turtle.getItemDetail(Slot_selected) if string.find(item_detail.name, "diam") ~= nil then dia = dia + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("diamond: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "iron") ~= nil then iron = iron + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("iron: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "copper") ~= nil then copper = copper + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("copper: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "gold") ~= nil then gold = gold + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("gold: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "silver") ~= nil then silver = silver + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("silver: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "tin") ~= nil then tin = tin + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("tin: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "coal") ~= nil then coal = coal + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("coal: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "lapis") ~= nil then lapis = lapis + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("lapis: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "emerald") ~= nil then emerald = emerald + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("emerald: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "ruby") ~= nil then ruby = ruby + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("ruby: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "sapphire") ~= nil then sapphire = sapphire + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("sapphire: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "peridot") ~= nil then peridot = peridot + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("peridot: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "redstone") ~= nil then redstone = redstone + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("redstone: " .. x .. " " .. y) h.close() elseif string.find(item_detail.name, "exploration") ~= nil then exploration = exploration + 1 local h = fs.open("finder/finder_text", "a") h.writeLine("exploration: " .. x .. " " .. y) h.close() end if turtle.getItemCount(Slot_selected) == 64 then Slot_selected = Slot_selected + 1 end turtle.select(Slot_selected) end end function throw_away() if Slot_selected == 15 then for q=1,15 do turtle.select(q) if turtle.getItemCount(q) > 0 then local item_detail = turtle.getItemDetail(q) if string.find(item_detail.name, "cobblestone") ~= nil then turtle.drop() elseif string.find(item_detail.name, "dirt") ~= nil then turtle.drop() elseif string.find(item_detail.name, "gravel") ~= nil then turtle.drop() end end end end end function makeLine() if Forward ~= Length then repeat dig() until Forward == Length else repeat digBack() until Forward == 0 end end function start() local h = fs.open("finder/finder_text", "w") h.writeLine(":D hey ") h.close() if turtle.forward() == false then while turtle.forward() == false do turtle.dig() end end print("Starting") repeat makeLine() Right = Right + 1 if Right ~= Width then if turn == "left" then turtle.turnRight() if turtle.forward() == false then while turtle.forward() == false do turtle.dig() end end check_ore() throw_away() turtle.turnRight() turn = "right" else turtle.turnLeft() if turtle.forward() == false then while turtle.forward() == false do turtle.dig() end end check_ore() throw_away() turtle.turnLeft() turn = "left" end end until Right == Width goBack() end function goBack() print(turn) print(Width) print(Length) local move_1 = 0 local move_2 = 0 if turn == "right" then turtle.turnRight() repeat turtle.forward() move_1 = move_1 + 1 until move_1 == (Width - 1) or turtle.forward() == false else turtle.turnLeft() turtle.turnLeft() repeat turtle.forward() move_2 = move_2 + 1 until move_2 == (Length) or turtle.forward() == false turtle.turnRight() repeat turtle.forward() move_1 = move_1 + 1 until move_1 == (Width - 1) or turtle.forward() == false end turtle.turnLeft() turtle.forward() readAll() end function printAll() if dia ~= 0 then print("dia: " .. dia) end if iron ~= 0 then print("iron: " .. iron) end if copper ~= 0 then print("copper: " .. copper) end if gold ~= 0 then print("gold: " .. gold) end if silver ~= 0 then print("silver: " .. silver) end if coal ~= 0 then print("coal: " .. coal) end if tin ~= 0 then print("tin: " .. tin) end if lapis ~= 0 then print("lapis: " .. lapis) end if emerald ~= 0 then print("emerald: " .. emerald) end if ruby ~= 0 then print("ruby: " .. ruby) end if sapphire ~= 0 then print("sapphire: " .. sapphire) end if peridot ~= 0 then print("peridot: " .. peridot) end if redstone ~= 0 then print("redstone: " .. redstone) end if exploration ~= 0 then print("exploration: " .. exploration) end end function readAll() printAll() print(" ") term.write("Type: 'r' to read, 'd' to delete or 'x' to exit") print(" ") answer = read() if answer == "r" then reader_go() elseif answer == "d" then deleteOrNot() elseif answer == "x" then print("Bye Bye :)") else print("No valid input") readAll() end end function reader_go() local h = fs.open("finder/finder_text", "r") repeat local line = h:readLine() print(line) until not line h.close() readAll() end function deleteOrNot() term.write("Delete all? y/n_ ") Delete = read() if Delete == "y" then print("Deleting finder folder and startup file") fs.delete("finder") if fs.exists("finder") then print("finder folder not deleted") end elseif Delete == "n" then readAll() else print("not a valid input") deleteOrNot() end end start()