Jump to content

Recommended Posts

Posted

I'm a real n00b to computercraft.

I tried something but when i run it it won't work :(

here's my code and error

code:

turtle.dig

turtle.forward

end

error:

bios:337: [string "new"]:2: '='

expected

Posted

so to elaborate a bit i think what your trying to do is get it to dig once and move forward i think to do that you need to edit your code like this

code:

turtle.dig(1)

turtle.forward(1)

end

Posted

Neither of the solutions worked, but now the error is al the same except for the '=' which is now '<eof>'.

Please help me I'm really looking forward to the easy way of mining...

Posted

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.

Posted

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

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...