Posted 07 May 2012 - 12:19 PM
rednet.open("top")
rec = rednet.receive()
repeat
print(rec)
sleep(0.2)
until nil
would this work to print everything which gets broadcasted over rednet?
rednet.open("top")
rec = rednet.receive()
repeat
print(rec)
sleep(0.2)
until nil
rednet.open("top")
while true do
event, var1, var2 = os.pullEvent()
if event == nil then
write("event is nill")
else
write("event is ".. event)
end
if var1 == nil then
write(" var1 is nill")
else
write(" var1 is "..var1)
end
if var2 == nil then
write(" var2 is nil")
else
write(" var2 is "..var2)
end
end
rednet.open("top")
rec = rednet.receive()
repeat
print(rec)
sleep(0.2)
until nil
rednet.open("top")
while true do -- Continues until terminated by the user or event specified
sender, message = rednet.receive(1.3) -- The argument stated here is a timeout,
or how long the machine will be receiving for before it jumps to the next line of code. This timeout will act as our sleep()
-- Also, rednet,receive() in its most basic form returns two values:
the id of the computer which sent the message, and the message which is self explanatory.
term.clear()
term.setCursorPos(1,1) -- Just clearing the screen
if sender == nil then print("Sorry! I got nothing...")
else print("Sender: "..sender.."nMessage: "..message)
end