Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- -- Check if there is less than 2 arguments
- if #args ~= 2 then
- print("Usage: strip <length> <amount>")
- return
- end
- -- Continue with the program
- local length = args[1] -- the first argument passed
- local amount = args[2] -- the second argument passed
- -- You can do some checking here
- if not tonumber(length) or tonumber(length) < 1 then
- print("length must be a positive number")
- return
- end
- if not tonumber(amount) or tonumber(amount) < 1 then -- Its saying there is a problem here
- print("amount must be a positive number")
- return
- end
- length = tonumber(length)
- amount = tonumber(amount)
- local function refuel()
- local fuelLevel = turtle.getFuelLevel()
- if fuelLevel == "unlimited" or fuelLevel > 0 then
- return
- end
- local function getfuel()
- if turtle.getItemCount(16) == 0 then
- turtle.select(14)
- turtle.place()
- turtle.select(16)
- turtle.suck()
- turtle.select(14)
- turtle.dig()
- turtle.select(1)
- end
- turtle.select(1)
- end
- local function tryRefuel()
- for n=1,16 do
- if turtle.getItemCount(n) > 0 then
- turtle.select(n)
- if turtle.refuel(1) then
- turtle.select(1)
- return true
- end
- end
- end
- turtle.select(1)
- return false
- end
- if not tryRefuel() then
- getfuel()
- end
- end
- local function emptyturtle()
- for s=1,12 do
- if turtle.getItemCount(s) > 0 then
- turtle.select(n)
- if turtle.getItemCount(12) > 0 then
- turtle.select(13)
- turtle.place()
- for ender1 = 1, 12 do
- turtle.drop()
- end
- turtle.select(1)
- turtle.dig()
- turtle.transferTo(13)
- turtle.select(1)
- else
- break
- end
- end
- end
- end
- torch = 0
- local function torched()
- if torch == 10 then
- turtle.select(15)
- turtle.placeDown()
- turtle.select(1)
- torch = 0
- end
- end
- local function detectup()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.4)
- end
- end
- local function strip()
- refuel()
- while not turtle.forward() do
- while not turtle.dig() do
- turtle.attack()
- end
- sleep(0.4)
- detectup()
- emptyturtle()
- end
- torch = torch + 1
- end
- local function otun()
- strip()
- strip()
- turtle.back()
- turtle.back()
- end
- local function turnaround()
- turtle.turnRight()
- strip()
- strip()
- strip()
- otun()
- turtle.turnRight()
- end
- for z = 1, amount do
- refuel()
- for x = 1, length do
- strip()
- torched()
- end
- refuel()
- turnaround()
- x = 0
- refuel()
- for x = 1, length do
- strip()
- torched()
- end
- turtle.turnLeft()
- strip()
- strip()
- strip()
- turtle.turnLeft()
- torch = 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement