2 posts
Posted 15 December 2012 - 12:17 PM
i copied this program from a forum and can't get it to work
here is the code i have in my turtle:
height = 2
length = 20
lengthCount = 0
heightCount = 1
function digHeight()
turtle.dig()
turtle.forward()
lenghtCount = lengthCount + 1
while heightCount < height do
turtle.digUp()
turtle.up()
heightCount = heightCount + 1
end
while heightCount > 1 do
turtle.down()
heightCount + heightCount - 1
end
end
while lengthCount < length do
digHeight()
end
turtle.turnLeft()
digHeight()
digHeight()
digHeight()
turtle.turnLeft()
lengthCount = 0
while lengthCount < length do
digHeight()
end
turtle.turnLeft()
digHeight()
digHeight()
digHeigh()
2005 posts
Posted 15 December 2012 - 12:25 PM
The parser needs to know what do do with the value of "heightCount + heightCount - 1". Where do you store that?
2088 posts
Location
South Africa
Posted 15 December 2012 - 12:28 PM
heightCount + heightCount - 1
The parser needs to know what do do with the value of "heightCount + heightCount - 1". Where do you store that?
I'm sure he meant
heightCount = heightCount - 1
seeming as the + is achieved from the same key as = but only if you hold shift. He must've have held shift ;)/>
2 posts
Posted 15 December 2012 - 12:49 PM
heightCount + heightCount - 1
The parser needs to know what do do with the value of "heightCount + heightCount - 1". Where do you store that?
I'm sure he meant
heightCount = heightCount - 1
seeming as the + is achieved from the same key as = but only if you hold shift. He must've have held shift ;)/>
omg wow i didn't notice that thx
7508 posts
Location
Australia
Posted 15 December 2012 - 02:27 PM
heightCount + heightCount - 1
The parser needs to know what do do with the value of "heightCount + heightCount - 1". Where do you store that?
I'm sure he meant
heightCount = heightCount - 1
seeming as the + is achieved from the same key as = but only if you hold shift. He must've have held shift ;)/>
omg wow i didn't notice that thx
just a little tip for you. the error information is AWESOME. see this: your title
[error] bios:338: [string "Stripmine"}]:17: '=' expectedit tells you that at line 17 in the program "Stripmine" that it expected an '=' sign. :)/>
hope this helps, any questions…. just ask :)/>
818 posts
Posted 16 December 2012 - 12:53 AM
The error codes are very confusing, so don't judge him
7508 posts
Location
Australia
Posted 16 December 2012 - 01:06 AM
The error codes are very confusing, so don't judge him
not judging. just informing incase he was unaware.
they could be more confusing, they could be like C++ and not tell you anything relevant about the error. the lua errors are, for the most part, a god send in comparison, we have heaps on info in it, we know that the program is called Stripmine, and that at line 17 there is a problem, and that it was expecting and '=' sign when clearly there wasn't.