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

Question with gps.locate

Started by XxLegendxX98, 24 May 2012 - 01:21 PM
XxLegendxX98 #1
Posted 24 May 2012 - 03:22 PM
If I were to have an IRC program setup, would it be possible to send gps.locate to a receiving computer and make that computer run it silently? I want the message that is sent to locate the coords of the computer, silently send the the coordinates back to the sending computer, then the sending computer would send the coordinates to a turtle for that turtle to locate the location of that computer, and destroy it. I'm having trouble on finding a way to send gps.locate to the computer silently and without having to install any programs into the receiving computer. Would that be possible in any way?
MysticT #2
Posted 24 May 2012 - 03:31 PM
The receiving computer should run that command, so you need to change the program to respond to that. Unless it's a program that runs any received messages and sends the results, and I suppose it's not.
BigSHinyToys #3
Posted 24 May 2012 - 03:34 PM
not possible. there would need to be some kind of malware installed on the target computer for it to send you its co-ords.

however if the target computer is broadcasting then it is possible to triangulate its signal. think about this there are four points in a 3d space. you know how far these points are from the target this value is a radius for a sphere. so you must find the point of intersection between these four spheres. that point is where the broadcast came from.

to do this you need four computers that are waiting for a signal. when these four computers recive one they send the distance to a fifth computer. the fifth computer must know the co-ordinates of the other four computers. then uses that and the distance to triangulate the signal. it is possible to do this by revise engineering the gps locate function.
XxLegendxX98 #4
Posted 24 May 2012 - 03:43 PM
not possible. there would need to be some kind of malware installed on the target computer for it to send you its co-ords.

however if the target computer is broadcasting then it is possible to triangulate its signal. think about this there are four points in a 3d space. you know how far these points are from the target this value is a radius for a sphere. so you must find the point of intersection between these four spheres. that point is where the broadcast came from.

to do this you need four computers that are waiting for a signal. when these four computers recive one they send the distance to a fifth computer. the fifth computer must know the co-ordinates of the other four computers. then uses that and the distance to triangulate the signal. it is possible to do this by revise engineering the gps locate function.

Thank you. I will try this. But what I was aiming for was to actually have it find the coords without having any clue at all where the computer is. Otherwise, needing to put four computers around it, I would need to know where it is. I was hoping to make a tekkit war server, so if you could somehow get into an IRC chat of someone you were trying to attack, you could locate them, and then have a turtle destroy their computer otherwise knocking out communications. Then with their communications destroyed it would actually make an opportunity to launch an attack. I may just attempt to add it in to the IRC chat program that is already built into the server.

EDIT:And also, how would I get the distance of the broadcasted messages? I haven't really played around with the rednet API a lot.
MysticT #5
Posted 24 May 2012 - 03:50 PM
The four computers just need to be in range to receive the messages from the target computer, wich you would need anyway to send it a message. So I think that's the best way to do it, you just place 4 computers in your base that receive broadcasted messages and send the distance to the sender to a master computer that locates that computer and sends the turtle. And it's not hard to code, since the locate function is already done in the gps api, you can just copy it and make some changes.
XxLegendxX98 #6
Posted 24 May 2012 - 03:55 PM
The four computers just need to be in range to receive the messages from the target computer, wich you would need anyway to send it a message. So I think that's the best way to do it, you just place 4 computers in your base that receive broadcasted messages and send the distance to the sender to a master computer that locates that computer and sends the turtle. And it's not hard to code, since the locate function is already done in the gps api, you can just copy it and make some changes.

Oh. I was meaning like what would I type in the receiving program to receive the distance of how far away the computer is that broadcasted the message?
MysticT #7
Posted 24 May 2012 - 03:59 PM
rednet.receive() or the "rednet_message" event, returns three arguments: the id of the sender, the message and the distance from the sender. That's what allows to locate computers. So you can do:

local id, msg, distance = rednet.receive()
to get the distance from a computer that sent a message.
XxLegendxX98 #8
Posted 24 May 2012 - 04:00 PM
rednet.receive() or the "rednet_message" event, returns three arguments: the id of the sender, the message and the distance from the sender. That's what allows to locate computers. So you can do:

local id, msg, distance = rednet.receive()
to get the distance from a computer that sent a message.

Oh alright, thanks.