This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
passengerpigeon's profile picture

Code to automatically reply to rednet messages

Started by passengerpigeon, 26 August 2015 - 08:16 AM
passengerpigeon #1
Posted 26 August 2015 - 10:16 AM
Dear programmers,
I am looking to create a simple internet on my world by programming computers to automatically reply to "rednet.send" messages. A similar thread has been made in the past, but the code provided threw up an error message and failed to reply to the sending computer when I tried to send a message. Also, that code only provides one reply; would it be possible for the server to respond with different strings depending on what message it received? For example, if the sender sent the string "Home", it would reply with one message, but if the sender sent "About" it would reply with a different one.
Thanks,
Passengerpigeon.
flaghacker #2
Posted 26 August 2015 - 04:37 PM
Just run a program that uses the rednet api? What part are you getting stuck with?
Exerro #3
Posted 26 August 2015 - 04:48 PM
I don't see anything wrong with the code shown in that topic, you are updating the modem side right? If not, you either need to place a modem on the top of both computers or change the rednet.open("top") to open the side you have the modem on of each computer.
passengerpigeon #4
Posted 26 August 2015 - 11:30 PM
Yes, the modem was connected and on the correct side when I tried it. I did add a rednet.host function to the code, though. Would that have caused it to break?
HPWebcamAble #5
Posted 27 August 2015 - 03:10 AM
For example, if the sender sent the string "Home", it would reply with one message, but if the sender sent "About" it would reply with a different one.

This is exactly what my Protocol API is for, why don't you check it out?
http://www.computercraft.info/forums2/index.php?/topic/22510-protocol-manager/page__fromsearch__1
Dragon53535 #6
Posted 27 August 2015 - 02:07 PM
So basically you're wanting to have two different programs, not with an internet per se, but with automatic replying to frequently asked questions?