Posted 22 January 2017 - 09:19 AM
So, basically I already tried to make a quaryy program, which actually worked, and right now I'm trying to make a farming program. The issue I'm having concerns the first lines of the farming sequence.
–Place turtle in rightmost position 1, 1, 1
–Declare dimensions
tArgs={…}
tVar={x, z}
for i=1, 2 do
tVar=tonumber(tArgs)
end
–forward mining
function turtle.advance(dist)
for Tz=1, dist do
turtle.dig()
turtle.forward()
end
end
–make turns
function turtle.uturnLeft()
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
end
function turtle.uturnRight()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
end
–real farming
print("harvesting")
for Tx=1, x do –error line
turtle.advance(z-1)
if Tx%2>0 then
turtle.uturnRight()
else
turtle.uturnLeft()
end
end
It tells me "'for' limit must be a number". I checked with type() function, and tVar are actually numbers.
What do I do now? What am i getting wrong?
Thanks everyone
–Place turtle in rightmost position 1, 1, 1
–Declare dimensions
tArgs={…}
tVar={x, z}
for i=1, 2 do
tVar=tonumber(tArgs)
end
–forward mining
function turtle.advance(dist)
for Tz=1, dist do
turtle.dig()
turtle.forward()
end
end
–make turns
function turtle.uturnLeft()
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
end
function turtle.uturnRight()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
end
–real farming
print("harvesting")
for Tx=1, x do –error line
turtle.advance(z-1)
if Tx%2>0 then
turtle.uturnRight()
else
turtle.uturnLeft()
end
end
It tells me "'for' limit must be a number". I checked with type() function, and tVar are actually numbers.
What do I do now? What am i getting wrong?
Thanks everyone