This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
worzel666's profile picture

[Error][Lua]'do' expected, Line 28, please help.

Started by worzel666, 18 August 2012 - 11:08 PM
worzel666 #1
Posted 19 August 2012 - 01:08 AM
So what I have been trying to do is get the turtle to mine a 2x2 hole to layer 12, and then mine a 2x2 tunnel until its inventory is full, when it comes back up to the top and sleeps while it is emptied. When I run it, I get: bios:206: [string "Tunnel"]:28: 'do' expected

http://pastebin.com/2PmHz9Bp

I am very new to programming, please help!
Cranium #2
Posted 19 August 2012 - 01:33 AM
When referring back to a variable in a place like line 28, we need to use "==" which means "evaluates equal" If you change it to that on the line, you should have no problem. Same with line 41. Needs to be "=="
worzel666 #3
Posted 19 August 2012 - 01:50 AM
Thanks for the help, after that it throws out no errors but doesn't do anything! What is wrong with the program?
ArchAngel075 #4
Posted 19 August 2012 - 01:50 AM
Not related to the helping out, but seeing as i just made my own sort of tunneling turtle i want to provide a pointer:

For those "turtle.dig()" and "turtle.forward()" lines first set these right at the top:
function RIGHT()
turtle.turnRight()
end

function LEFT()
turtle.turnLeft()
end

ETC

This way you just need to type in LEFT() or RIGHT() instead of a long line of "turtle.turnLeft"

EDIT:
OK i think you forgot to run the function "inv()" ? Since i see nothing thats executing an function after setting them up.
worzel666 #5
Posted 19 August 2012 - 01:58 AM
Thanks, I changed that now, but the turtle still sits and does nothing.
Noodle #6
Posted 19 August 2012 - 04:59 AM
Thanks, I changed that now, but the turtle still sits and does nothing.
Your turtle must be on hardcore mode. Go to your config file and change it to 0.
worzel666 #7
Posted 19 August 2012 - 10:41 AM
I'm using version 1.33 on a server, and I made another program and it worked without fuel. I have tried filling the turtle with fuel, but it does nothing.
BigSHinyToys #8
Posted 19 August 2012 - 11:14 AM
Here is your code fixed so it will run. i haven't fixed other errors example the face it spins around a lot doing not much
http://pastebin.com/KPb2SBK1
worzel666 #9
Posted 20 August 2012 - 10:43 AM
Thank you! I fixed the stupid movement order, I might have been a bit tired when I wrote that.
immibis #10
Posted 20 August 2012 - 02:04 PM
The reason it didn't do anything before is that all of your code was inside the inv function.