Here is the code,
1.
print ("----------Welcome to CobbruAutopilot 0.1!--------")
2.
local delay=2
3.
k=0
4.
rednet.open("right")
5.
print ("Retrieving actual position...")
6.
print ("Please wait...")
7.
local x1, y1, z1 = gps.locate(5)
8.
if x1 == nil or y1 == nil or z1 == nil then
9.
print ("Unable to get gps signal. Maybe it's raining or there aren't gps satellites in the area")
10.
print ("Use the manual program")
11.
print ("Turning off the computer....")
12.
os.sleep(5)
13.
os.shutdown()
14.
else
15.
print ("Your actual position is ",x1," ",y1," ",z1)
16.
end
17.
print ("Where do you want to move?")
18.
print ("Insert x coordinate")
19.
local x2 = read()
20.
print ("Insert y coordinate")
21.
local y2 = read()
22.
print ("Insert z coordinate")
23.
local z2 = read()
24.
xnew=x2-x1
25.
if xnew > 0 then
26.
for i=1,xnew do
27.
rs.setBundledOutput("back",colors.lightBlue)
28.
os.sleep(delay)
29.
rs.setBundledOutput("back",0)
30.
os.sleep(delay)
31.
i=i+1
32.
end
33.
else
34.
xnew=x1-x2
35.
for i=1,xnew do
36.
rs.setBundledOutput("back",colors.yellow)
37.
os.sleep(delay)
38.
rs.setBundledOutput("back",0)
39.
os.sleep(delay)
40.
i=i+1
41.
end
42.
end
43.
ynew=y2-y1
44.
if ynew > 0 then
45.
for i=1,ynew do
46.
rs.setBundledOutput("back",colors.brown)
47.
os.sleep(delay)
48.
rs.setBundledOutput("back",0)
49.
os.sleep(delay)
50.
i=i+1
51.
end
52.
else
53.
ynew=y1-y2
54.
for i=1,ynew do
55.
rs.setBundledOutput("back",colors.white)
56.
os.sleep(delay)
57.
rs.setBundledOutput("back",0)
58.
os.sleep(delay)
59.
i=i+1
60.
end
61.
end
62.
znew=z2-z1
63.
if znew > 0 then
64.
for i=1,znew do
65.
rs.setBundledOutput("back",colors.blue)
66.
os.sleep(delay)
67.
rs.setBundledOutput("back",0)
68.
os.sleep(delay)
69.
i=i+1
70.
end
71.
else
72.
znew=z1-z2
73.
for i=1,znew do
74.
rs.setBundledOutput("back",colors.orange)
75.
os.sleep(delay)
76.
rs.setBundledOutput("back",0)
77.
os.sleep(delay)
78.
i=i+1
79.
end
80.
end
81.
print("Arrived!")
I was wondering if i could get it to check again when it had arrived at the designated area to make sure that it was in the place it should have been. If not then it would keep going, Is this possible?