Posted 18 January 2014 - 02:35 PM
Hi guys! This is my first time posting here and really my first time coding something a little more complicated.
this is a program written for a digging turtle that travels along and replaces whatever dirt block is below it with a stone brick.
I'm having trouble with it however:
i thought it was pretty robust and functional, but i seem to be doing something wrong with the functions, or the if-else statement, because it gives me an error when i run the program. (I named it roadbuilder)
the error message is as follows:
bios:337: [string "roadbuilder"]:34: '=' expected
why do i need an = at line 34? this doesn't make sense to me
any help would be appreciated! Thanks
this is a program written for a digging turtle that travels along and replaces whatever dirt block is below it with a stone brick.
I'm having trouble with it however:
function digbuild()
while turtle.detectDown() do
turtle.digDown()
turtle.placeDown()
end
end
function edges()
if turtle.detectLeft()then
turtle.turnLeft()
turtle.back()
turtle.place()
turtle.digDown()
turtle.turnLeft()
turtle.placeDown()
turtle.turnLeft()
else
while turtle.detectRight() do
turtle.turnRight()
turtle.back()
turtle.place()
turtle.digDown()
turtle.turnRight()
turtle.placeDown()
turtle.turnRight()
end
end
end
blocked = turtle.detect()
if blocked ~= true then
turtle.forward
digbuild()
else
edges()
turtle.forward()
digbuild()
end
i thought it was pretty robust and functional, but i seem to be doing something wrong with the functions, or the if-else statement, because it gives me an error when i run the program. (I named it roadbuilder)
the error message is as follows:
bios:337: [string "roadbuilder"]:34: '=' expected
why do i need an = at line 34? this doesn't make sense to me
any help would be appreciated! Thanks