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

[solved]I Keep Getting 'then' expected

Started by Rangicus, 20 May 2012 - 03:31 PM
Rangicus #1
Posted 20 May 2012 - 05:31 PM
In Line 11 it say 'then' expected! i am trying to make a mining program for my turtle

print("User What Should I Call You?")
x = io.read()
print("Okay "..x.."")
print(""..x.." How Many Blocks Should I Mine Downward?")
y = io.read()
textutils.slowPrint("3..2..1")
print("Going Down!")
y = tonumber(y)
z = y

if y == 0 false then
turtle.digDown()
y = y - 1
end
if y == 0 then
turtle.up()
z - 1
end
if z == 0 then
os.shutdown()
end

EDIT-The Program is like what is you name? then how long down you want to dig? then digs down and comes up
Teraminer #2
Posted 20 May 2012 - 06:00 PM
I think you need to put an end after z = y so like this:

Spoiler

print("User What Should I Call You?")
x = io.read()
print("Okay "..x.."")
print(""..x.." How Many Blocks Should I Mine Downward?")
y = io.read()
textutils.slowPrint("3..2..1")
print("Going Down!")
y = tonumber(y)
z = y
if y == 0 false then
turtle.digDown()
y = y - 1
end
if y == 0 then
turtle.up()
z - 1
end
if z == 0 then
os.shutdown()
end
to
print("User What Should I Call You?")
x = io.read()
print("Okay "..x.."")
print(""..x.." How Many Blocks Should I Mine Downward?")
y = io.read()
textutils.slowPrint("3..2..1")
print("Going Down!")
y = tonumber(y)
z = y
end

if y == 0 false then
turtle.digDown()
y = y - 1
end
if y == 0 then
turtle.up()
z - 1
end
if z == 0 then
os.shutdown()
end
Cloudy #3
Posted 20 May 2012 - 07:25 PM
Line 11 has a random false after the if statement.
MysticT #4
Posted 20 May 2012 - 07:28 PM
Change this:

if y == 0 false then
to this:

if y ~= 0 then