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

Is there a way to prevent the intended message such as "yoko52" from turning into "1285yoko525" ?

Started by Spartan5573, 10 November 2012 - 11:30 AM
Spartan5573 #1
Posted 10 November 2012 - 12:30 PM
So, in part of my code it says this:

elseif input == "A" then
sleep(1)
rednet.send(1295, "yoko52")
sleep(1)
shell.run("standby")

But, the computer receiving this gets

1285yoko525

I'm confused as to why that is, and would like a way to fix it if at all possible. Thank you.
bjornir90 #2
Posted 10 November 2012 - 12:33 PM
What is your method to retrieve the message ?
Kingdaro #3
Posted 10 November 2012 - 12:43 PM
Aha, I see what your receiving computer is doing.

When you just spit out all of its arguments all at once

print(rednet.receive())
it meshes all of it together, instead of spacing it out. (LIKE IT SHOULD, HINT HINT)

Your computer is really receiving the right message, but in the following format.

id, msg, dist = rednet.receive()
-- id is the computer that sent the message
-- msg is the actual message
-- dist is how far away the other computer is.
-- if we print the msg
print(msg)
-- we should get, in this case,
--> yoko52
Spartan5573 #4
Posted 10 November 2012 - 01:47 PM
Okay, that makes sense, thank you