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

try "turtle.dig()" and "turtle.forward()" as they are both functions and need the parentheses at the end to indicate that.

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

its been a while since i did any lua you might want to head over to the computer craft forums they were very helpful to me last time i was playing with lua

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.

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...