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

Turtle Help

Started by freiguy48, 12 April 2012 - 11:52 PM
freiguy48 #1
Posted 13 April 2012 - 01:52 AM
Hey I was making a program to have a turtle detect a tree then cut it down even when I am away but I get the error bios:206: [string "startup"]:12:'<eof>' expected

The code is:
x = 0
while true do
term.clear()
term.setCursorPos(1,1)
write("Waiting")
textutils.slowPrint("…")
sleep(0)
if turtle.detect() == false then
sleep(1)
end
end
elseif turtle.detect() == true then
break
end
end
x = 0
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Cutting…")
turtle.dig()
turtle.forward()
while true do
x = x + 1
turtle.digUp()
turtle.up()
if turtle.digUp() == false then
break
end
end
while true do
x = x - 1
turtle.down()
if x == 0 then
turtle.back()
turtle.drop()
os.reboot()
end

Not sure why it won't show the spaces but there are spaces
Luanub #2
Posted 13 April 2012 - 02:03 AM
You ended this if statement prior to the elseif.

change

while true do
term.clear()
term.setCursorPos(1,1)
write("Waiting")
textutils.slowPrint("...")
sleep(0)
if turtle.detect() == false then
sleep(1)
end
end
elseif turtle.detect() == true then
break
end
end

to

while true do
term.clear()
term.setCursorPos(1,1)
write("Waiting")
textutils.slowPrint("...")
sleep(0)
if turtle.detect() == false then
sleep(1)
elseif turtle.detect() == true then
break
end -- ends if statement
end -- ends while loop