Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xChest = -135
- local yChest = 85
- local zChest = 74
- -- N
- -- z
- -- Wx xE
- -- z
- -- S
- -- chest pos: x: -135 y: 85 z: 74
- -- OldPos x: -143 y: 87 z: 81
- -- NewPos x: -143 y: 87 z: 82
- local xOld, yOld, zOld = gps.locate(5)
- print("x: " .. xOld .. " y: " .. yOld .. " z: " .. zOld)
- turtle.forward()
- local xNew, yNew, zNew = gps.locate(5)
- print("x: " .. xNew .. " y: " .. yNew .. " z: " .. zNew)
- turtle.back()
- -- X-axis
- print(xChest - xOld)
- if (xChest - xOld) > 0 then
- for i = 1,(xChest - xOld), 1 do
- turtle.back()
- end
- end
- if (xChest - xOld) < 0 then
- for i = 1,((xChest - xOld)*(-1)), 1 do
- turtle.forward()
- end
- end
- --> 0 forward
- --< 0 backwards
- -- 0 nothing
- -- Y-axis
- print(yChest - yOld)
- if (yChest - yOld) > 0 then
- for i = 1,(yChest-yOld), 1 do
- turtle.up()
- end
- end
- if (yChest - yOld) < 0 then
- for i = 1,((yChest-yOld)*(-1)), 1 do
- turtle.down()
- end
- end
- -- > 0 up
- -- < 0 down
- -- 0 nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement