Posted 18 December 2013 - 08:43 AM
hi
I followd a toturial for programing turtle for digging whit cordination, and he was using computercraft 1.3 I belive. and i have 1.5. what I found out is that ther are different ways to program for 1.3 and 1.5. here is the link to the toturial: http://www.youtube.com/watch?v=CORN_u7TASI
my turtle just spins to the right
my program:
xCoord = 230
zCoord = 231
yCoord = 75
orientation = 3
orientations = "north", "east", "south", "west"
zDiff = -1, 0, 1, 0
xDiff = 0, 1, 0, -1
function left()
orientation = orientation - 1
orientation = (orientation - 1) % 4
orientation = orientaion +1
turtle.turnLeft()
end
function right()
orientation = orientation - 1
orientation = (orientation + 1) % 4
orientation = orientation + 1
turtle.turnRight()
end
function moveForward()
xCoord = xCoord + xDiff[orientation]
zCoord = zCoord + zDiff[orientation]
turtle.dig()
move = false
while not (moved) do
moved = turtle.forward()
print"I tried to move"
end
print"I moved"
end
function moveUp()
yCoord = yCoord + 1
moved = false
while not (moved) do
moved = turtle.up()
end
end
function moveDown()
yCoord =yCoord -1
turtle.digDown()
moved = false
while not (moved) do
moved = turtle.down()
end
end
function look(direction)
while direction ~= orientations[orientation] do
right()
end
end
function goto(xTarget, zTarget, yTarget)
if yTarget < yCoord then
moveDown()
end
while yTarget > yCoord do
moveUp()
end
if xTarget < xCoord then
look("west")
while xTarget < xCoord do
moveForward()
end
end
if xTarget > xCoord then
look("east")
while xTarget >xCoord do
move Forward()
end
end
if zTarget < zCoord then
lokk("northe")
while zTarget < zCoord do
moveForward()
end
end
end
goto(264, 230, 76)
I followd a toturial for programing turtle for digging whit cordination, and he was using computercraft 1.3 I belive. and i have 1.5. what I found out is that ther are different ways to program for 1.3 and 1.5. here is the link to the toturial: http://www.youtube.com/watch?v=CORN_u7TASI
my turtle just spins to the right
my program:
xCoord = 230
zCoord = 231
yCoord = 75
orientation = 3
orientations = "north", "east", "south", "west"
zDiff = -1, 0, 1, 0
xDiff = 0, 1, 0, -1
function left()
orientation = orientation - 1
orientation = (orientation - 1) % 4
orientation = orientaion +1
turtle.turnLeft()
end
function right()
orientation = orientation - 1
orientation = (orientation + 1) % 4
orientation = orientation + 1
turtle.turnRight()
end
function moveForward()
xCoord = xCoord + xDiff[orientation]
zCoord = zCoord + zDiff[orientation]
turtle.dig()
move = false
while not (moved) do
moved = turtle.forward()
print"I tried to move"
end
print"I moved"
end
function moveUp()
yCoord = yCoord + 1
moved = false
while not (moved) do
moved = turtle.up()
end
end
function moveDown()
yCoord =yCoord -1
turtle.digDown()
moved = false
while not (moved) do
moved = turtle.down()
end
end
function look(direction)
while direction ~= orientations[orientation] do
right()
end
end
function goto(xTarget, zTarget, yTarget)
if yTarget < yCoord then
moveDown()
end
while yTarget > yCoord do
moveUp()
end
if xTarget < xCoord then
look("west")
while xTarget < xCoord do
moveForward()
end
end
if xTarget > xCoord then
look("east")
while xTarget >xCoord do
move Forward()
end
end
if zTarget < zCoord then
lokk("northe")
while zTarget < zCoord do
moveForward()
end
end
end
goto(264, 230, 76)