Difference between revisions of "Wireless Modem"
(Quick fix of crafting recipe) |
|||
Line 2: | Line 2: | ||
{{Block | {{Block | ||
|name=Modem | |name=Modem | ||
− | |image= | + | |image=WirelessModem.png |
− | |id= | + | |id=4094 |
− | |damage-value= | + | |damage-value=1 |
|is-peripheral=Yes | |is-peripheral=Yes | ||
− | |peripheral-api= | + | |peripheral-api=Modem (API) |
}} | }} | ||
− | Modems are blocks which can be used to wirelessly transfer data between [[Computer|computers]] and [[Turtle|turtles]], using the [[Rednet_(API)|Rednet API]]. | + | Modems are blocks which can be used to wirelessly transfer data between [[Computer|computers]] and [[Turtle|turtles]], using the [[Rednet_(API)|Rednet API]] or the [[Modem_(API)|Modem API]]. |
To place a modem on a side of a computer, right-click to place the modem while sneaking. | To place a modem on a side of a computer, right-click to place the modem while sneaking. | ||
Line 21: | Line 21: | ||
{{Crafting grid | {{Crafting grid | ||
|A1=stone |B1=stone |C1=stone | |A1=stone |B1=stone |C1=stone | ||
− | |A2=stone |B2= | + | |A2=stone |B2=redstone_torch |C2=stone |
|A3=stone |B3=stone |C3=stone | |A3=stone |B3=stone |C3=stone | ||
|Output=Modem | |Output=Modem | ||
}} | }} | ||
− | == Example == | + | |
+ | == Example (Rednet API)== | ||
* Place 2 computers and add modems to them by clicking the right mouse button while sneaking. | * Place 2 computers and add modems to them by clicking the right mouse button while sneaking. | ||
* Access them, and start Lua. | * Access them, and start Lua. | ||
Line 33: | Line 34: | ||
* Now, type "[[rednet_(API)|rednet]].[[rednet.broadcast|broadcast]] ('<your message>')" on the other computer. This should send your message to all computers connected. | * Now, type "[[rednet_(API)|rednet]].[[rednet.broadcast|broadcast]] ('<your message>')" on the other computer. This should send your message to all computers connected. | ||
* Opening the first computer should show the message written on the second computer. | * Opening the first computer should show the message written on the second computer. | ||
+ | |||
==Modem as a Peripheral== | ==Modem as a Peripheral== |
Revision as of 08:44, 29 March 2013
This page needs some serious TLC, stat! Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: The behaviour of Rednet has changed as of 1.5 - please consider updating this page with information. (Please don't add prerelease info!)) |
Modem | |
Item ID | 4094 |
Damage Value | 1 |
Peripheral? | Yes- Modem (API) |
Modems are blocks which can be used to wirelessly transfer data between computers and turtles, using the Rednet API or the Modem API. To place a modem on a side of a computer, right-click to place the modem while sneaking.
It is also possible to turn the modem on and off by typing "rednet.open ( side )" to open and "rednet.close ( side )" to close.
Modems can send messages to other modems located up to 64 meters away, or 16 meters during a thunderstorm. As of 1.4 Modem range is increased with higher altitudes. If there is no thunderstorm, the range will always be higher than 64, and at max altitude you would have a range of 384 meters.
In 1.4 and 1.41 there is a miscalculation that causes the range to only be 381 meters at max altitude.
Recipe
Example (Rednet API)
- Place 2 computers and add modems to them by clicking the right mouse button while sneaking.
- Access them, and start Lua.
- Once Lua has started, type "rednet.open ("<relative location to modem, e.g. left, right>")" on both computers.
- Check if there exists a connection: a dim, red light should be found on the modem.
- Type on one computer "rednet.receive (60)". This will make the computer freeze for 60 seconds, or until it has received a signal from the other computers.
- Now, type "rednet.broadcast ('<your message>')" on the other computer. This should send your message to all computers connected.
- Opening the first computer should show the message written on the second computer.
Modem as a Peripheral
To use a Modem as a peripheral, you need to either call a method directly using peripheral.call(), or, wrap the modem using the Peripheral API. Wrapped modems provide all functions listed in the Rednet API.
For this example, we have a Modem connected to the top of our Computer:
-- Immediately invoke a method without wrapping peripheral.call("top", "open")
-- You can also "wrap" the peripheral side to a variable: local modem = peripheral.wrap("top") modem.open("top")