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

Can't Get Rednet To Print Broadcasts Right?

Started by Kraethi, 17 October 2013 - 10:13 PM
Kraethi #1
Posted 18 October 2013 - 12:13 AM
Hey, me again. I've written a couple programs that use Rednet, and one that is supposed to say whether a file existed on another computer is giving me trouble. No matter what the program name I give it, it always returns a blank line instead of the "SUCCESS" or "FAILURE" I want it to. Here are the programs.

Sending End:

rednet.open("back")
while true do
print("Execute Instructions")
local input = read()
if input == "Lockdown" then
  shell.run("Lockdown")
else
  while true do
   rednet.broadcast(input)
   message = rednet.receive()
   print(text)
   break
  end
end
end

Receiving End:

rednet.open("back")
while true do
  event, id, text = os.pullEvent()
  if event == "rednet_message" then
   if fs.exists(text) then
	rednet.broadcast("SUCCESS")
	shell.run(text)
   else rednet.broadcast("FAILURE")
  end
end
end

How can I get my code back on the sending end to display the correct success/failure printout?
LBPHacker #2
Posted 18 October 2013 - 12:15 AM
local id, message = rednet.receive()
Kraethi #3
Posted 18 October 2013 - 12:17 AM
Thanks very much, that did the trick! Jeez, how do I miss these things.