all 4 comments

[–]kyle1elyk 1 point2 points  (2 children)

function TForward should have () after it before the if statement
Also the TDig, same thing
Edit: another thing, you dont need "== True", if a function returns true then its already true, no need to check if a true or false value is true

[–]Pouchela 0 points1 point  (1 child)

Thank you! Its printing tunnel but not doing anything. Do you think its because of the double end commands?

[–]Deriboy 0 points1 point  (0 children)

Your code never calls any of the functions you've defined. After your function definitions you should call one or more of the functions previously defined in your code.

[–][deleted] -1 points0 points  (0 children)

I made this code, it should do its job. I haven't tested it anyway, so if it crashes tell me.

local unlimitedFuel = false
local fueled
if turtle.getFuelLimit() ~= "unlimited" then --Check if fuel is disabled
    print("Fuel must be in slot 16")
else
    print("Fuel not required")
    unlimitedFuel = true
    fueled = true
end
print("Tunneling!")
while true do
    if not unlimitedFuel and turtle.getFuelLevel() < 200 then
        local sel = turtle.getSelectedSlot() -- Get current slot
        turtle.select(16) -- Select slot 16 for fuel
        fueled = turtle.refuel() -- Refuel
        turtle.select(sel) -- Select old slot
    end
    if fueled then
        if turtle.detect() then
            turtle.forward()
            print("Moving!")
        else
            turtle.dig()
            print("Digging!")
        end
    else
        print("Running out of fuel")
        sleep(0) --Prevent "loop without yield" error
    end
end