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

Goto me program - I need help!

Started by big02001, 04 April 2014 - 07:11 PM
big02001 #1
Posted 04 April 2014 - 09:11 PM
So, i am making a program that using the GPS and rednet functions. I also installed the 'Goto" program onto my turtle.

I have a pocket computer APP and a turtle APP that work together, i have the pocket computer sending rednet messages to the turtle telling the turtle where to go i have it so i can type in 'home' and 'store' and it will fly/pathfind there. i want to make it so i can type 'me' and then the turtle locates me, i have a GPS system hooked up already, i just cant seem to find a way to give my coords to the turtle through rednet. Thanks in advance :D/>

If you want the code, here they are

Turtle:W8CaXYeE



Pocket Computer: http://pastebin.com/Q5seS6iz
Edited on 04 April 2014 - 08:53 PM
big02001 #2
Posted 04 April 2014 - 11:23 PM
Help me D:
Cranium #3
Posted 04 April 2014 - 11:34 PM
Please don't bump your topic to add visibility. Be patient, and someone will help you.
Unfortunately, I don't work too much with the GPS system in ComputerCraft, or I would help you out.
CometWolf #4
Posted 04 April 2014 - 11:50 PM
Not so much related to the GPS as just rednet in general really. You can just send the result of gps.locate over rednet.

local tPos = {}
tPos.x,tPos.y,tPos.z = gps.locate()
if not tPos.x then
  --GPS failed
  return
end
rednet.send(id,tPos)

local _id,tPos = rednet.receive()
turtle.moveTo(tPos.x,tPos.y,tPos.z) --or however your turtle commands work.
guesswhat123212 #5
Posted 05 April 2014 - 02:47 AM
or just have it send three rednet messages to the turtle for your x,y,z

for the turtle it would look something like

function goToMe()
  sid,  x, d = rednet.receive()
  sid,  y, d = rednet.receive()
  sid,  z, d = rednet.receive()
  goto(x,y,z)
end
Lyqyd #6
Posted 05 April 2014 - 04:30 AM
It's definitely easier and quicker to send the coordinates as a single table rather than three individual messages.


local pos = vector.new(gps.locate())
if pos.y == 0 then
  return
end
rednet.send(pos)
big02001 #7
Posted 05 April 2014 - 06:28 PM
Thanks a ton guys, i was stumped on that one!