Posted 14 September 2013 - 10:28 AM
Title: Turtle map tacker
Hello guys i am new to the minecraft game and it is indeed an amazing game. A day ago i got into working with the turlte bots to automate some tasks. I am having some problems with a map tracker that i am making. Basically it records the steps it has done so far ( left, forward, etc.) and when the fuel level reaches a certain value and there is also no more items for fuel it retraises it's steps. i have made a small program for testing this mapping but am having a weird problem. It saves the moves correctly ( into the array "map")but when it reaches the fuel limit it does not retrace the last 5 steps ( this is a test program and i am only saving the last 5 steps). When i check the contents of the array (map) all the elements are now nil. I tried to narrow it down and the problem seems to lie in the if statement for the fuel or slot checker though i am not sure. Thank you for your respons in advance.
map = {}
i = 5
if turtle.getFuelLevel() <= 140 then
if turtle.getItemCount(1) == 0 then
for count = 1,5 do
if map == 1 then
turtle.back()
end
if map == 2 then
turtle.forward()
end
if map == 3 then
turtle.down()
end
if map == 4 then
turtle.up()
end
if map == 5 then
turtle.turnRight()
end
if map == 6 then
turtle.turnLeft()
end
i = i - 1
end
else
turtle.select(1)
turtle.refuel()
end
else
i = 5
turtle.forward()
map[1] = 1
turtle.up()
map[2] = 3
turtle.forward()
map[3] = 1
turtle.up()
map[4] = 3
turtle.back()
map[5] = 2
end
Hello guys i am new to the minecraft game and it is indeed an amazing game. A day ago i got into working with the turlte bots to automate some tasks. I am having some problems with a map tracker that i am making. Basically it records the steps it has done so far ( left, forward, etc.) and when the fuel level reaches a certain value and there is also no more items for fuel it retraises it's steps. i have made a small program for testing this mapping but am having a weird problem. It saves the moves correctly ( into the array "map")but when it reaches the fuel limit it does not retrace the last 5 steps ( this is a test program and i am only saving the last 5 steps). When i check the contents of the array (map) all the elements are now nil. I tried to narrow it down and the problem seems to lie in the if statement for the fuel or slot checker though i am not sure. Thank you for your respons in advance.
map = {}
i = 5
if turtle.getFuelLevel() <= 140 then
if turtle.getItemCount(1) == 0 then
for count = 1,5 do
if map == 1 then
turtle.back()
end
if map == 2 then
turtle.forward()
end
if map == 3 then
turtle.down()
end
if map == 4 then
turtle.up()
end
if map == 5 then
turtle.turnRight()
end
if map == 6 then
turtle.turnLeft()
end
i = i - 1
end
else
turtle.select(1)
turtle.refuel()
end
else
i = 5
turtle.forward()
map[1] = 1
turtle.up()
map[2] = 3
turtle.forward()
map[3] = 1
turtle.up()
map[4] = 3
turtle.back()
map[5] = 2
end