Rednet Tutorial
From ComputerCraft Wiki
Revision as of 18:27, 7 July 2012 by 109.240.87.163 (Talk) (Created page with "Rednet is a wonderfull thing that allows computers and turtles interact with each other, like internet. == Getting started == Attatch a wireless modem to your computer Modem...")
Rednet is a wonderfull thing that allows computers and turtles interact with each other, like internet.
Getting started
Attatch a wireless modem to your computer
Modem is made with 8 stone surrounding redstone torch.
Rednet scripts
Rednet uses some strings to interact with other computers
Here is a basic program that runs most of them. Need 2 pcs.
PC1
rednet.open("right") --change right to side of modem
rednet.broadcast("Hello world")
print("PC1 - Hello world")
rednet.receive()
if ip == 2 and message == "Hello from pc2" then
write("PC2 -")
print(message)
rednet.send("2","How are you")
print("PC1 - How are you")
rednet.receive(10)
if message == "Fine thanks" then
print("PC2 - Fine thanks"
end
end
print("disconnecting")
rednet.close("right")
PC2
rednet.open("right")
rednet.receive()
if ip == 1 and message == "Hello world" then
rednet.send("1","Hello from pc2")
rednet.receive()
if message == "How are you" then
rednet.broadcast("Fine thanks")
end
end
rednet.close("right")
Open Pc2 first after that open pc1 and then run the program
what?
When computer sends information with rednet it sends the id and message. This can be used in receiving end to activate some strings if message is correct and id is correct. Hope this helped!