This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dexter9's profile picture

Automatic Transport

Started by dexter9, 19 February 2013 - 03:52 AM
dexter9 #1
Posted 19 February 2013 - 04:52 AM
Hi Ive had tekkit for quite a while now and i now have a server. I recnelty created a small car with redpower frames and motors. It works very well. This may sound nice but its not very user friendly using redpowers computers to control it. I was wondering if i could get computercraft to gather its co-ordinates and then ask for the destinations co-ordinates and then move the seperate motors using bundled cable till the car got there. Is this possible and how would i do it?
Lyqyd #2
Posted 19 February 2013 - 07:01 AM
This is significantly more difficult on Tekkit due to the fact that there are several bugs which are present in the very outdated version Tekkit uses that are not present in the current version. So much so that I will not provide help for anyone attempting to use ComputerCraft and frames in Tekkit (especially not with GPS involved). I hope someone else is willing to help you through it.
dexter9 #3
Posted 19 February 2013 - 08:18 AM
Ok ive found a program on pastebin anyway.I do wish tekkit would update but wishing wont help. Thank anyway
dexter9 #4
Posted 19 February 2013 - 12:05 PM
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?
dexter9 #5
Posted 20 February 2013 - 12:38 AM
Hi, basically i have cars on my server which redpowers frames. They work really well but they could be even better using computercraft. Basically what i want the cars to do is to have a computer that locates its GPS position and then asks the driver the destination co-ordinates. I know to do this i need satellites (ie. computercraft high in sky with modems). Along with this i want the satellites to bounce messages around.
ie.
Computer A: says Hi—> this is sent to the satellite Computer B/C/D/E( 4 satellites high up receive this message) –> then they send on to a further distance to the corresponding computer. IS this possible to do and can i achieve this with one satellite?
Kingdaro #6
Posted 20 February 2013 - 12:43 AM
If your redpower frame cars can move in all four (six?) directions, then I don't see why not.
dexter9 #7
Posted 20 February 2013 - 12:51 AM
Yes everything works that way. I was wondering about the computer though acting as a gps and forwarding messages, is there any available code?
Left4Cake #8
Posted 20 February 2013 - 03:33 AM
Did you take a look at the code for the GPS program that is already a part of computercraft? I look at the default code all the time when I am working on stuff.
dexter9 #9
Posted 20 February 2013 - 05:26 AM
Yes. Got all taht working but can i make a computer do both things?

*that
Lyqyd #10
Posted 20 February 2013 - 05:57 AM
Threads merged. Of course it is possible to also have GPS towers relay rednet messages. You may find it easiest to use the parallel API, but it would be relatively trivial to add GPS responses to an existing relaying program, which is probably the better option.
FuuuAInfiniteLoop(F.A.I.L) #11
Posted 20 February 2013 - 06:00 AM
Why tekkit?, you can use minecraft 1.4.6(redpower has been updated!)