Jump to content

Computercraft turtle error


nickelbink

Recommended Posts

just took a closer look and your 'end' is also a problem. you only need to 'end' if you're in a control loop, like a 'while' or 'if', etc. so just try:


turtle.dig()

turtle.forward()

see if that does the trick.

Link to comment
Share on other sites

Thnx weirleader without the 'end' it works fine, but the turtle won't go forward.

EDIT: my turtle needed a refuel, like i said i am a n00b.

Thanks for helping everyone

since you say you're a n00b, allow me to give you some extra advice:

* when mining, if you ever try to customize programs (as opposed to using the default 'tunnel' or 'excavate' programs), be sure to use something like the following to help deal with things like gravel, mobs, or even just empty space that doesn't require digging:


local function TryFwd()

    if turtle.detect() then

        turtle.dig()

    end

    while not (turtle.forward()) do

        print('oops! bumped something')

        sleep(0.5)

    end

end



 

* if you haven't made use of it, something like



tArg = {...}



will gather command-line arguments so you can pass additional info to your program at runtime; just be sure to reference each argument (tArg[1], tArg[2], ...) like an array and you may even want error-handling; e.g.,



-- no length supplied; error out with message

if #tArg ~= 1 then

    print("Usage: bridgeS <length>")

    print("must have length/9 blocks in inventory to function.")

    return

end

I'm sure there are many other tips out there, but the first bit took me the longest to figure out; I'd have turtles not moving quite the way they were supposed to and no idea why.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...