CC: Tweaked

CC: Tweaked

57M Downloads

`rednet.lookup` is returning nil (`chat` program has stopped working)

Cheatoid opened this issue ยท 5 comments

commented

Minecraft Version

1.18.x

Version

1.100.2

Details

As the title says.
Simplest way to reproduce this issue is to make use of the chat program.
Place down a computer with modem on side, access the terminal and enter chat host room.
Place down another computer with modem on side, access the terminal and enter chat join room username, and then here you will see the issue:

Looking up room... Failed.

commented

I think I figured it out. It is because both computers have the identical metadata/ID, so it ends up failing during lookup... ๐Ÿ˜†
This is so silly. It is easy to get multiple computers with identical ID while in creative, simply destroy a computer after placing it, and then middle click it on hotbar.

commented

Can you check the id of those two command computers (run id program in shell)? In creative it's possible to place two computers with the same id, and that might cause problems like this.

commented

I think I figured it out. It is because both computers have the identical metadata/ID, so it ends up failing during lookup... ๐Ÿ˜† This is so silly. It is easy to get multiple computers with identical ID while in creative, simply destroy a computer after placing it, and then middle click it on hotbar.

It is working like that on purpose. Cause if computer sends message to itself (its own ID) it is just queued as event and it allows multiple programs on same computer to communicate over rednet without actually having any modems on the computer cause it is all in effect loopback communication.

if recipient == os.getComputerID() then
-- Loopback to ourselves
os.queueEvent("rednet_message", os.getComputerID(), message_wrapper, protocol)
sent = true
else

So if there are multiple computers with same ID they are unable to communicate with each other cause of said ID collision. Lucky it can't happen in normal game play.

commented

I can't seem to replicate your issue. Did exactly what your steps were and it worked correctly. Can you provide screenshots of your setup/other details or save file with this issue in action?
obraz
obraz

commented

Well this is strange. It does not work in this particular setup which I have here, not sure why.
I just tested it again by placing a new set of computers and it works fine.

Video demo: https://streamable.com/udq3zy