
Untitled
By: a guest on
Aug 19th, 2012 | syntax:
Lua | size: 1.82 KB | hits: 6 | expires: Never
local x = -886
local y = 514
local z = 64
local dx = 0
local dz = 0
local dy = 0
local id = os.computerID()
rednet.open("right")
rednet.send(607," activated at"..x..", "..y..", "..z.." distance:")
function goToAndExcavate(fx,fy)
goToPos(fx,fy, 100)
shell.run("excavate", 1)
travelY(1)
goToPos(-879,64,526)
end
function travelX(a)
print("going "..a.." along x")
local distanceGone =0
if (a>0)then
while(turtle.forward()and distanceGone<a) do
if(distanceGone<a) then
x=x+1
distanceGone = distanceGone+1
end
end
else if(a>0) then
while(turtle.back()and distanceGone<a) do
if(distanceGone<a) then
x=x-1
distanceGone = distanceGone-1
end
end
end
end
end
function travelZ(a)
print("going "..a.." along z")
turtle.turnRight()
local distanceGone =0
if (a>0)then
while(turtle.back()and distanceGone<a) do
if(distanceGone<a) then
z=z+1
distanceGone = distanceGone+1
end
end
else if(a>0) then
while(turtle.back()and distanceGone<a) do
if(distanceGone<a) then
z=z-1
distanceGone = distanceGone-1
end
end
end
end
turtle.turnLeft()
end
function travelY(a)
print("going "..a.." along y")
local distanceGone =0
if (a>0)then
while(turtle.down()and distanceGone<a) do
if(distanceGone<a) then
y=y+1
distanceGone = distanceGone+1
end
end
else if(a>0) then
while(turtle.up()and distanceGone<a) do
if(distanceGone<a) then
y=y-1
distanceGone = distanceGone-1
end
end
end
end
end
function goToPos(newX, newZ, newY )
shell.run("go","forward", newX-x)
shell.run("go","right", 1)
shell.run("go","forward", newZ-z)
shell.run("go","left", 1)
shell.run("go","up", newY-y)
y=newY
z=newZ
x=newX
end
goToPos(-879,526,64)
print(x)
print(y)
print(x)
print(Z)