Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- todo section
- -- enter to terminate/pause
- local tArgs={...}
- if tArgs[1] == nil then
- term.clear()
- term.setCursorPos(1, 1)
- print("How far do you want to go?")
- tArgs[1] = read()
- end
- local function clear()
- term.clear()
- term.setCursorPos(1, 1)
- end
- local function timesfuelcheck()
- term.clear()
- term.setCursorPos(1, 1)
- print("turtle will stop when this number reaches zero: "..m)
- print("fuel remaining: "..turtle.getFuelLevel())
- print("blocks dug: "..dignumb)
- if extrainfonumb ~= 0 then
- print(extrainfo)
- elseif extrainfonumb == 0 then
- end
- term.setCursorPos(1, 12)
- print("Bottom right slot needs to have torches")
- end
- local function checkdig()
- while turtle.detect() do
- turtle.dig()
- dignumb=dignumb+1
- timesfuelcheck()
- sleep(.5)
- end
- while turtle.suck() do
- end
- end
- local function checkdigUp()
- while turtle.suckUp() do
- end
- while turtle.detectUp() do
- turtle.digUp()
- dignumb=dignumb+1
- timesfuelcheck()
- sleep(.5)
- end
- end
- local function checkdigDown()
- while turtle.suckDown() do
- end
- while turtle.detectDown() do
- turtle.digDown()
- dignumb=dignumb+1
- timesfuelcheck()
- sleep(.5)
- end
- end
- local function checkdigLeft()
- turtle.turnLeft()
- checkdig()
- turtle.turnRight()
- end
- local function checkdigRight()
- turtle.turnRight()
- checkdig()
- turtle.turnLeft()
- end
- local function checkplaceDown()
- turtle.select(1)
- while not turtle.detectDown() do
- if turtle.placeDown() == true then
- turtle.placeDown()
- elseif turtle.placeDown() == false then
- x = 1
- repeat
- print("Something failed. Attempting to fix it.")
- x=x+1
- turtle.select(x)
- sleep(.3)
- until
- x==15 or turtle.placeDown() == true
- if x==15 then
- term.clear()
- term.setCursorPos(1, 1)
- print("no placeable items in any of the slots")
- print("rechecking in four seconds.")
- print("4")
- sleep(1)
- print("3")
- sleep(1)
- print("2")
- sleep(1)
- print("1")
- sleep(1)
- print("rechecking")
- sleep(.5)
- checkplaceDown()
- elseif turtle.placeDown() == true then
- sleep(.3)
- print("continuing")
- end
- end
- end
- end
- BlocksNeeded = 10
- TorchesNeeded = tArgs[1] / 5
- local i = 0
- local timer = os.startTimer(1)
- clear()
- while math.ceil(TorchesNeeded - turtle.getItemCount(16)-1) >= 0 do
- clear()
- if BlocksNeeded-turtle.getItemCount(1)-1 >= 0 then
- print("I recommend "..BlocksNeeded-turtle.getItemCount(1).." more blocks.")
- end
- if math.ceil(TorchesNeeded - turtle.getItemCount(16)) >= 0 then
- print("Need "..math.ceil(TorchesNeeded-turtle.getItemCount(16)).." more torches in the bottom right slot.")
- else
- print("Enough torches")
- end
- print()
- print(" Press any letter to skip")
- local evt, arg = os.pullEvent()
- if evt == "timer" then
- if arg == timer then
- i = i + 1
- print(i)
- timer = os.startTimer(1)
- end
- elseif evt == "char" then
- break
- end
- end
- clear()
- turtle.select(1)
- dignumb = 0
- extrainfonumb = 0
- m = tArgs[1]
- torch = 5
- for i = 1, tArgs[1] do
- timesfuelcheck()
- checkdig()
- turtle.forward()
- checkdigLeft()
- checkdigRight()
- checkdigUp()
- turtle.up()
- checkdigLeft()
- if torch == 5 then
- turtle.turnRight()
- checkdig()
- turtle.select(16)
- if turtle.place() == true then
- extrainfonumb = 3
- extrainfo = "placing torch"
- timesfuelcheck()
- turtle.place()
- torch = 0
- else
- extrainfonumb = 3
- extrainfo = "unable to place"
- timesfuelcheck()
- torch = 0
- end
- turtle.turnLeft()
- turtle.select(1)
- else
- checkdigRight()
- end
- checkdigDown()
- turtle.down()
- checkdigDown()
- turtle.down()
- checkplaceDown()
- checkdigLeft()
- checkdigRight()
- turtle.up()
- torch = torch+1
- if extrainfonumb ~= 0 then
- extrainfonumb = extrainfonumb-1
- end
- m = m-1
- timesfuelcheck()
- end
Add Comment
Please, Sign In to add comment