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

Turtle pumpkin farm code error

Started by kcid, 01 September 2012 - 06:02 AM
kcid #1
Posted 01 September 2012 - 08:02 AM
error is on the 15th line and '=' expected is the error.

I would greatly appreciate some help here


code:

x = 0
y = 0
z = 22

turtle.turnRight()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()

goto = moveright

moveright

if x == z then <—————— this line over here

turtle.turnLeft()
goto = farmstart

else

turtle.dig()
turtle.foreward()
x = x + 1
goto = moveright

end

farmstart

if y == 28 then

turtle.turnLeft()
turtle.turnLeft()

goto = endfarmstart

else

turtle.dig()
turtle.foreward()
y = y+1

goto = farmstart

end

endfarmstart

if y == 0 then

x = 0
goto = mainfarm

else

turtle.dig()
turtle.foreward()
y = y-1

end

mainfarm

turtle.turnRight()
turtle.dig()
turtle.foreward()
turtle.foreward()
turtle.dig()
turtle.foreward()
turtle.turnRight()

if x == 7 then

goto = donemain

else

goto = notdoneyet

end

notdoneyet

if y == 28 then

turtle.turnLeft()
turtle.dig()
turtle.foreward()
turtle.turnLeft()
goto = commingback

else

turtle.dig()
turtle.foreward()
y = y+1

end

commingback

if y == 0 then

x = x+1
goto = mainfarm

else

turtle.dig()
turtle.foreward()
y = y-1

end

donemain

if y == 28 then

turtle.turnLeft()
turtle.turnLeft()

goto = donefarming

else

turtle.dig()
turtle.foreward()
y = y+1

goto = donemain

end

donefarming

if y == 0 then

x = 0
goto = comminghome

else

turtle.dig()
turtle.foreward()
y=y-1
goto = donefarming

end

comminghome

if x == 18 then

goto = home

else

turtle.dig()
turtle.foreward()

x = x+1
goto = comminghome

end

home

turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.turnRight()

turtle.drop(64)
turtle.drop(64)
turtle.drop(64)
turtle.drop(64)
turtle.drop(64)
turtle.drop(64)
turtle.drop(64)
turtle.drop(64)
turtle.drop(64)


end
Kazimir #2
Posted 01 September 2012 - 08:17 AM
In this version Lua there is no operator GOTO, use a function.
kcid #3
Posted 01 September 2012 - 08:40 AM
okay, thank you