Posted 24 December 2012 - 04:04 PM
Since there is no call to get ahold of turtles locations, my idea was to store it to a variable for x coods and z coords. ex:
However, the problem with this is if the program is terminated, and the turtle is not at (0,0), (0,0) is then moved and all reference coordinates would be thrown off… so a few questions…
1. Is this the best way to keep track of the turtle?
2. Can i save information without storing it to a file with the vault API?
3. If no, can someone explain how to use the vault API a little bit more thoroughly to me?
direction = 1
turtleOneXCoord = 0
turtleOneZCoord = 0
while true do
direction = 1
turtleOneXCoord = 0
turtleOneXCoord = 0
while true do
-- some sort of input to go forward 1 square
if direction == 1 then
turtle.forward()
turtleOneXCoord = turtleOneXCoord + 1
elseif direction == 2 then
turtle.forward()
turtleOneZCoord = turtleOneZCoord + 1
elseif direction == 3 then
turtle.forward()
turtleOneXCoord = turtleOneXCoord - 1
elseif direction == 4 then
turtle.forward()
turtleOneZCoord = turtleOneZCoord - 1
end
--some sort of input to turn right
direction = direction + 1
--some sort of input to turn left
direction = direction - 1
end
with this, I can note down coordinates important to the turtle (like a restock chest)However, the problem with this is if the program is terminated, and the turtle is not at (0,0), (0,0) is then moved and all reference coordinates would be thrown off… so a few questions…
1. Is this the best way to keep track of the turtle?
2. Can i save information without storing it to a file with the vault API?
3. If no, can someone explain how to use the vault API a little bit more thoroughly to me?