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

[TURTLE]

Started by dorky1, 08 July 2012 - 04:42 AM
dorky1 #1
Posted 08 July 2012 - 06:42 AM
I'm not sure if it works but I making my first program.
Once done, the turtle will dig 1x16 tunnel with tnt 5 blocks apart.
How to use: Place down your turtle on the side of a wall you want to hollow into a room (the tunnel will be 1 block behind the turtle and 1 block up from that.

Here's the code:


textutils.slowWrite( "OK, I will start to dig and place tnt." )
turtle.up()
wait (0.2)
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turtle.forward()
tryDig()
turnRight(2)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turnRight(2)
tryPlace(1)
turnRight(2)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turnRight(2)
tryPlace(1)
turnRight(2)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turnRight(2)
tryPlace(1)
turtle.down()
textutils.slowWrite( "Job Done! ")
end

I am getting an error that says this when I run the program:
bios:206: string "tnt"]:66:
'<eof>' expected

Why do I get this error?
Xfel #2
Posted 08 July 2012 - 08:25 AM
You don't need to put 'end' at the end of your programs.
Remove it, and it'll be fine.
ardera #3
Posted 08 July 2012 - 09:19 AM
Here is a shorter version:
(in the spoiler)
Spoiler


textutils.slowWrite( "OK, I will start to dig and place tnt." )
turtle.up()
wait(0.2)
for n=1, 14 do
  tryDig()
  turtle.forward()
end
tryDig()
turnRight(2)
for n=1, 7 do
  turtle.forward()
end
turnRight(2)
tryPlace(1)
turnRight(2)
for n=1, 6 do
  turtle.forward()
end
turnRight(2)
tryPlace(1)
turnRight(2)
for n=1, 7 do
  turtle.forward()
end
turnRight(2)
tryPlace(1)
turtle.down()
textutils.slowWrite( "Job Done! ")