Difference between revisions of "Modem message (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page)
 
(Added NeedsWork tag, due to broken template)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
 +
{{NeedsWork|The event template is broken, and will not display more than three events. Until this can be fixed, this page is incomplete.}}
 
{{Event
 
{{Event
 
|name=modem_message
 
|name=modem_message
Line 8: Line 9:
 
|return4=The message received in string format. If the message was previously a table, see [[textutils.unserialize]].
 
|return4=The message received in string format. If the message was previously a table, see [[textutils.unserialize]].
 
|return5=The distance (in blocks) between the two computers.
 
|return5=The distance (in blocks) between the two computers.
 +
}}
 
{{Example
 
{{Example
 
|desc=Prints details of the message received.  
 
|desc=Prints details of the message received.  
Line 16: Line 18:
 
  end
 
  end
 
|output=Will print out all details of the message received on the modem.
 
|output=Will print out all details of the message received on the modem.
}}
 
 
}}
 
}}

Revision as of 11:33, 4 October 2013


This page needs some serious TLC, stat!
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: The event template is broken, and will not display more than three events. Until this can be fixed, this page is incomplete.)
Grid Modem.png  Event modem_message
Fired when any modem message arrives through an open modem.
Returned Object 1 The side of the computer where the message was received.
Returned Object 2 The frequency that the message has been received on.
Returned Object 3 The frequency that the sender defined when sending the message.
Returned Object 4 The message received in string format. If the message was previously a table, see textutils.unserialize.
Returned Object 5 The distance (in blocks) between the two computers.


Grid paper.png  Example
Prints details of the message received.
Code
while true do
  event, side, frequency, replyFrequency, message, distance = os.pullEvent("modem_message")
  print("Message received fromt the open modem on the "..side.." side of this computer.\nFrequency: "..frequency.."\nRequested reply frequency: "..replyFrequency.."\nDistance: "..distance.."\nMessage is as follows: "..message)
end
Output Will print out all details of the message received on the modem.