Difference between revisions of "Modem message (event)"
From ComputerCraft Wiki
(Created page) |
Bomb Bloke (Talk | contribs) m |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
{{Event | {{Event | ||
|name=modem_message | |name=modem_message | ||
− | |desc=Fired when any modem message arrives through an open modem. | + | |desc=Fired when any modem message arrives through an open modem channel. If the message arrived cross-dimensionally, then the distance argument is set to nil. |
|return1=The side of the computer where the message was received. | |return1=The side of the computer where the message was received. | ||
|return2=The frequency that the message has been received on. | |return2=The frequency that the message has been received on. | ||
|return3=The frequency that the sender defined when sending the message. | |return3=The frequency that the sender defined when sending the message. | ||
− | |return4=The message received | + | |return4=The message received. It will remain the same type as was transmitted. |
|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 13: | Line 14: | ||
while true do | while true do | ||
event, side, frequency, replyFrequency, message, distance = [[os.pullEvent]]("modem_message") | event, side, frequency, replyFrequency, message, distance = [[os.pullEvent]]("modem_message") | ||
− | [[print]]("Message received | + | [[print]]("Message received from the open modem on the "..side.." side of this computer.") |
+ | [[print]]("Frequency: "..frequency..") | ||
+ | [[print]]("Requested reply frequency: "..replyFrequency..") | ||
+ | [[print]]("Distance: "..distance..") | ||
+ | [[print]]("Message is as follows: "..message) | ||
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. | ||
− | |||
}} | }} |
Latest revision as of 10:54, 27 December 2015
![]() | |
Prints details of the message received. | |
Code |
while true do event, side, frequency, replyFrequency, message, distance = os.pullEvent("modem_message") print("Message received from the open modem on the "..side.." side of this computer.") print("Frequency: "..frequency..") print("Requested reply frequency: "..replyFrequency..") print("Distance: "..distance..") print("Message is as follows: "..message) end |
Output | Will print out all details of the message received on the modem. |