Jump to content




Goto me program - I need help!


  • You cannot reply to this topic
6 replies to this topic

#1 big02001

  • Members
  • 11 posts

Posted 04 April 2014 - 08: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 by big02001, 04 April 2014 - 09:53 PM.


#2 big02001

  • Members
  • 11 posts

Posted 04 April 2014 - 10:23 PM

Help me D:

#3 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 04 April 2014 - 10: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.

#4 CometWolf

  • Members
  • 1,283 posts

Posted 04 April 2014 - 10: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.


#5 guesswhat123212

  • Members
  • 31 posts

Posted 05 April 2014 - 01: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


#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 April 2014 - 03: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)


#7 big02001

  • Members
  • 11 posts

Posted 05 April 2014 - 05:28 PM

Thanks a ton guys, i was stumped on that one!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users