Posted 28 February 2012 - 11:27 AM
So I've never really had a use for a counter of any sort until I ran into Turtles. Pretty easy to achieve what I wanted, the only problem I'm having is I can not get it to work with local vars, only global which I would prefer to stay away from.. Any tips on how to get this code to work with local vars?
This can be deleted I figured it out, I was over complicating it… I've updated the code to work
Spoiler
function harvest()
print ()
print ("Harvesting Trees...")
local rownum = 7
local fwd = 0
local height = 0
while rownum ~= 0 do
while turtle.detect() == true do
turtle.dig()
turtle.forward()
fwd = fwd + 1
while turtle.detectUp() == true do
turtle.digUp()
turtle.up( 1 )
height = height + 1
end
repeat
if height >= 1 then
turtle.down()
height = height - 1
end
until height == 0
end
repeat
turtle.back()
fwd = fwd - 1
until fwd == 0
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
rownum = rownum - 1
end
turtle.turnLeft()
for x = 1, 7 do
turtle.forward()
end
turtle.turnRight()
for x = 1, 7 do
turtle.forward()
end
main()
end
This can be deleted I figured it out, I was over complicating it… I've updated the code to work
Edited on 28 February 2012 - 10:38 AM