rednet.send

From ComputerCraft Wiki
Revision as of 01:00, 24 February 2014 by Bomb Bloke (Talk | contribs) ("WaitUntilPortOpen" is not currently a valid parameter; suspect it was pre-1.5 behaviour?)

Jump to: navigation, search


Grid Redstone.png  Function rednet.send
Allows a computer / turtle with an attached modem to send a message intended for a system with a specific ID. At least one such modem must first be "opened" with eg rednet.open() before sending is possible. Assuming the target was in range and also had a correctly opened modem, it can then use rednet.receive() to collect the message. See also rednet.broadcast().

Note that any systems in range are capable of receiving the message if their owners have some idea what ID you're targeting - they need only use modem.open()

To get the ID of a given system, refer to os.computerID().
Syntax rednet.send(number receiverID, string message)
Returns boolean success code. True if a message has been sent (note - "sent", as opposed to "received" or even "was receivable"), false if not.
Part of ComputerCraft
API rednet

Examples

Grid paper.png  Example
Sends a message to the system with the ID of 22 (assuming a modem is attached and open).
Code
rednet.send(22,"ComputerCraft")