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

Rednet/variables

Started by Razputin, 26 August 2013 - 08:38 PM
Razputin #1
Posted 26 August 2013 - 10:38 PM
So I have a setup where the user types in the message they want and the computer sends it to a second computer that just 'listens' and then puts it up on its monitor. How do I get the user input saved to a variable and passed to the second pc?


print("What would you like to send?")
local msge   //?
input = msge
rednet.open("top")
rednet.send(6, msge , true) //?
rednet.close("top")
jay5476 #2
Posted 27 August 2013 - 02:28 AM

write("Enter Message: ")
input = read()
rednet.open(side)
rednet.send(id, input)
rednet.close(side)
and then for recieving

while true do
id,msg,distance = rednet.recieve()
-- do stuff with msg
end
replace id and side with relative sides and ids
Razputin #3
Posted 27 August 2013 - 07:10 PM
Thanks a lot man!