11 posts
Posted 24 May 2013 - 08:25 PM
Hello, im sortof new to computercraft and i need some help. im making a stairs program but everytime i run it it gives me: bios:206: [string "stairs"]:2: '=' expected. I donk know how to fix it and I've looked at line two ten times. Heres the code:
(P.S: W.I.P.)
turtle.refuel
turtle.digDown()
turtle.down
turtle.digForward()
turtle.forward()
turtle.digForward()
turtle.forward()turtle.digForward()
turtle.forward()
turtle.backward()
turtle.backward()
turtle.backward()
8543 posts
Posted 25 May 2013 - 12:25 AM
Split into new topic.
You're missing the parentheses on line one (should be `turtle.refuel()` instead). Since they're not there, it thinks you're going to assign a new value, so it's expecting to see an assignment operator (=), and when it gets to line 2, it finds something else, but still hasn't found the assignment operator. It then throws that error. Add your parentheses to line one and it'll be fixed.
11 posts
Posted 25 May 2013 - 09:35 PM
Thanks, but now it says the same thing except for line four (
bios:206: [string "stairs"]:4: '=' expected
). I didn't even edit line two which was causing the problem…
8543 posts
Posted 25 May 2013 - 09:37 PM
And if you look at the line above line four, there is, big surprise, another function call missing its parentheses.
7508 posts
Location
Australia
Posted 25 May 2013 - 09:41 PM
You would have fixed line 1. Line 1 was the problem.
Now the new problem is on line 3. because again you're missing the () on the function call of `turtle.down()` … in order to call a function you must have parentheses or it will think that you're attempting to assign a value to it.
EDIT: Naw look at this… Lyqyd ninjaing… :ph34r:/>
11 posts
Posted 25 May 2013 - 11:24 PM
Thank you again. That almost fixed it. My plan is to repeat this command over and over again in the program. Well, now it says stairs:4: attempt to call nil.
Here's the (so-far) edited code:
turtle.refuel()
turtle.digDown()
turtle.down()
turtle.digForward()
turtle.forward()
turtle.digForward()
turtle.forward()
turtle.digForward()
turtle.forward()
turtle.backward()
turtle.backward()
turtle.backward()
–repeated over and over
18 posts
Posted 25 May 2013 - 11:41 PM
It's called "documentation" and you should try reading it.
11 posts
Posted 25 May 2013 - 11:46 PM
Whats called "documentation"?
7083 posts
Location
Tasmania (AU)
Posted 25 May 2013 - 11:47 PM
The number tells you what line has the error. Line four reads "turtle.digForward()". Check what the
Turtle API has to say about the digging functions.
18 posts
Posted 25 May 2013 - 11:55 PM
Whats called "documentation"?
I'll give you a little hint.
http://puu.sh/31hG2.png
8543 posts
Posted 25 May 2013 - 11:59 PM
What the above posters are getting at is that the function you want is turtle.dig(), not turtle.digForward(). They're pointing you toward the documentation because you're asking questions which could easily be answered by spending a couple minutes reading the relevant pages on the Wiki.
You'll want to look into for or while loops to make your code repeat.
11 posts
Posted 26 May 2013 - 02:50 PM
Ahhhhhhhhhh… That fixed the problem along with looking up loops and changing the turtle.backward() to turtle.back(). Thank you soo much.