• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# test

a guest May 26th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. function determine_position()
2.     print("Enter the turtle's current coordinates (make sure the turtle is facing NORTH)")
3.
4.     term.write("X:")
6.
7.     term.write("Y:")
9.
10.     term.write("Z:")
12. end
13.
14. function strafe(direction)
15.
16.     if direction == "right" then
17.         turtle.turnRight()
18.         turtle.forward()
19.         turtle.turnLeft()
20.     elseif direction == "left" then
21.         turtle.turnLeft()
22.         turtle.forward()
23.         turtle.turnRight()
24.     end
25. end
26.
27. function move_to_position(ex,ey,ez)
28.     --moving on y axis first
29.     if y > ey then
30.         turtle.down()
31.         y = y - 1
32.     elseif y < ey then
33.         turtle.up()
34.         y = y + 1
35.     end
36.
37.     --moving on x axis second
38.     if y == ey then
39.         if x > ex then
40.             strafe("left")
41.             x = x - 1
42.         elseif x < ex then
43.             strafe("right")
44.             x = x + 1
45.         end
46.         print(x)
47.     end
48.     --moving on z axis third
49.     if z == ez then
50.         if z > ez then
51.             turtle.forward()
52.             z = z - 1
53.         elseif z < ez then
54.             turtle.back()
55.             z = z + 1
56.         end
57.     end
58. end
59.
60. x = -2111
61. y = 10
62. z = -99
63.
64. v = true
65. while v do
66.     move_to_position(-2091,4,-99)
67. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top