https://s3-us-west-2.amazonaws.com/secure.notion-static.com/18f3e634-bb9d-476a-859d-72249206fd95/05-quick-look-up.png

ComputerCraft has its own version of networking, called rednet, which can be used as Minecraft wifi.

What you’ll learn:

We can take advantage of this to remotely trigger other computers and Redstone events within the wireless range. In this example, we’ll set off some fireworks in a dispenser using Redstone.

-- Remote Fireworks
-- Jim Christian (jimchristian.net)
-- Coding in Minecraft
-- Use rednet to trigger a Redstone signal on another computer
-- Code for both computers below. Delete where appropriate.

-- Remote Fireworks (PC 1)
-- Adapted from <http://www.computercraft.info/wiki/Rednet_Tutorial>
-- make sure you get the correct IDs of the computers you want to communicate with.

rednet.open("right") -- activate the modem attached to the right side of the computer
rednet.broadcast("launch status") -- wirelessly request launch status from all computers in range
print("firework1 - launch status") -- output your broadcast to the computer screen
id,message = rednet.receive() -- listen for a communication back over rednet
if id == 4 and message == "firework2 ready to launch" then -- if the appropriate computer ID and message are correct then
 write("firework2 -") -- begin writing the response
 print(message) -- to the computer screen
 rednet.send(4,"Go for launch") -- send a command to the computer with the ID of '4' (firework2)
 print("firework1 - go for launch")  -- output your broadcast to the computer screen 
 id,message = rednet.receive(10) -- Wait until a message arrives or 10 seconds pass
 if message == "Watch the skies" then -- if the correct message comes back then
  print("firework2 - watch the skies") -- output it to the screen
 end -- end our second if statement
end -- end our first if statement
print("disconnecting") -- tell the user what you're doing
rednet.close("right") --disable modem on the right side of the PC

-- Remote Fireworks (PC 2)
-- Adapted from <http://www.computercraft.info/wiki/Rednet_Tutorial>
-- make sure you get the correct IDs of the computers you want to communicate with.

rednet.open("left") --enable modem on the left side of the PC
id,message = rednet.receive()  -- listen for a communication over rednet
if id == 5 and message == "launch status" then -- if launch status is requested by a computer with ID of 5 then
 rednet.send(5,"firework2 ready to launch") -- reply back to the computer with an ID of 5
 id,message = rednet.receive() -- Wait until a message is received
 if message == "Go for launch" then -- if the correct message is received from firework1 then
  rednet.broadcast("Watch the skies") -- Send to all PCs in range
  redstone.setOutput("bottom", true) -- activate Redstone through the bottom of the computer
  sleep(2) -- wait two seconds
  redstone.setOutput("bottom", false) -- deactivate Redstone through the bottom of the computer
 end -- end our second if statement
end -- end our first if statement
rednet.close("right") -- disable modem on the right side of the PC