os.loadAPI("try") os.loadAPI("check") local dir = true local slot = 1 local inv = 0 local tArgs = { ... } if # tArgs ~= 2 then print("Usage: patch ") return end width = tonumber(tArgs[1]) height = tonumber(tArgs[1]) local maxBlocks = width * height for i = 1,16 do inv = inv + turtle.getItemCount(i) end if maxBlocks > inv then print("Running this script may require more blocks than are available. Are you sure you want to continue? (Y/N)") end while true do local event, char = os.pullEvent("char") if char == "y" then break elseif char == "n" then return else sleep(0.2) end end local function slotCheck() while turtle.getItemCount(slot) == 0 do slot = slot + 1 end turtle.select(slot) end for i = 1,width do for j = 1,height do slotCheck() if not turtle.place() and not turtle.detect() then turtle.attack() end if j ~= height then if dir then if not try.up() then print("Cannot move up! Exiting script...") return end elseif not try.down() then print("Cannot move down! Exiting script...") return end end end if i ~= width then turtle.turnRight() if not try.forward() then print("Cannot move forward! Exiting script...") return end turtle.turnLeft() end end