Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --follower turtle--
- function setup()
- print("what's the id of the compact computer you want to conect with?")
- id = read()
- end
- function getcor()
- local x, y, z = gps.locate()
- if rednet.recieve() then
- xt, yt, zt = rednet.recieve()
- xm = x-xt -- west-east
- ym = y-yt
- zm = z-zt -- north-south
- end
- end
- function forward()
- while not turtle.forward() do
- rednet.send(id,"unable to move =(")
- sleep(2)
- end
- end
- function up()
- while not turtle.up() do
- rednet.send(id,"unable to go up =(")
- sleep(2)
- end
- end
- function down()
- while not turtle.down() do
- rednet.send(id,"unable to go down")
- sleep(2)
- end
- end
- function N()
- if direct==2 then
- turtle.turnLeft()
- elseif direct==3 then
- turtle.turnLeft()
- turtle.turnLeft()
- elseif direct==4 then
- turtle.turnRight()
- end
- direct=1
- end
- function E()
- if direct==1 then
- turtle.turnRight()
- elseif direct==3 then
- turtle.turnLeft()
- elseif direct == 4 then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- direct=2
- end
- function S()
- if direct==1 then
- turtle.turnLeft()
- turtle.turnLeft()
- elseif direct==2 then
- turtle.turnLeft()
- elseif direct==4 then
- turtle.turnRight()
- end
- direct=3
- end
- function W()
- if direct==1 then
- turtl.turnRight()
- elseif direct==2 then
- turtle.turnLeft()
- turtle.turnLeft()
- elseif direct==3 then
- turtle.turnLeft()
- end
- direct=4
- end
- function move()
- if ym>0 then
- up()
- elseif ym<0 then
- down()
- elseif xm>0 then
- W()
- forward()
- elseif xm<0 then
- E()
- forward()
- elseif zm>0 then
- N()
- forward()
- elseif zm<0 then
- S()
- forward()
- end
- end
- --here starts the script
- setup()
- print("this program is made by wv1106 on reddit and pastebin")
- print("open the other part of the script on a wireless or ender pocket computer")
- while 1 do
- getcor()
- move()
- end
Add Comment
Please, Sign In to add comment