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

NFC like Rednet feature

Started by wilcomega, 11 October 2014 - 09:41 AM
wilcomega #1
Posted 11 October 2014 - 11:41 AM
i have already suggested this before, BUT before you leave, i think i was a bit unclear with what i meant in that post so here we go

a feature built into the rednet api to see the distance for a wirless message, now in my previous post people thought that i meant, like from i=one side hrough like 5 repeaters and back, that kind of distance, no i accually mean that the distance will be nill or 0 if the message is not wireless. also it will only display the distance from the the last sender, for example if your the message goes through a repeater it will not display the total distance but only the last distance, from the repeater to you.

now this would be very usefull because:
now you can make a system where it will check if a pocket computer is close. currently you will have to work around rednet and directly interface the modem, wich some might like but me personnaly i think that rednet should be used for all communication as this is a universal system. that is why i requested this feature.

also, one last thing, i know i can do this myself, i know the there is a large chance that this wont get inplemented, so please only reply with usefull informaton instead of:
"You can easely write this yourself!", "this is dumb", "i dont see any uses for it", "why dont you write it yourself?", please, no

-wilco
Edited on 11 October 2014 - 09:42 AM
theoriginalbit #2
Posted 11 October 2014 - 12:14 PM
I'm pretty sure that's how ComputerCraft already works, last I checked it was a node-to-node distance, not a source-to-target distance.
Lyqyd #3
Posted 11 October 2014 - 07:48 PM
I'm pretty sure that's how ComputerCraft already works, last I checked it was a node-to-node distance, not a source-to-target distance.

Yep, you're right, but the distance is only available through the modem events now (which he mentions, and says he wants it from rednet message events too), since rednet message events return sender, message and protocol.

wilcomega, the problem with the suggestion is that it would create inconsistent return values with rednet messages. Messages that have been repeated onward from another computer will still appear to have been sent directly by that computer, but the distance value that the modem message event came in with was the distance to the repeater computer. It wouldn't make sense to provide distance only for computers able to send/receive directly to/from each other when part of the point of the rednet API is to abstract away the underlying complexities and allow for simplified point-to-point communication without needing any knowledge of the network topology between the two hosts. This really is something that the modem message event is meant for.