Posted 14 March 2013 - 04:15 AM
Ok I got a small problem. When ever I have the program check to see if a port is open, I guess ports can be open even if the modem isn't connected so it always comes back as true. I want it to be able to tell if it is able to receive messages or at the very least see if a modem and port is open.
Also I know it's possible but how do you make it so that it will open all sides or check each side to see if the modem is there then open that sides port as this code I made works but if the modem is on another side I have to manually change it lol.
I'm also not always able to look at the monitor so I don't want the messages automatically cleared. Is there a guide on making a program do something when you press a button as I can't seem to find one or even know what it's called lol.
The last thing is I can't get the write() to do all 3 things in one line. I know there's a way to do something like write(ID, ": ", message) or even with print but every time I try it with , or . like it has it in the wiki it doesn't work for me.
Also I know it's possible but how do you make it so that it will open all sides or check each side to see if the modem is there then open that sides port as this code I made works but if the modem is on another side I have to manually change it lol.
I'm also not always able to look at the monitor so I don't want the messages automatically cleared. Is there a guide on making a program do something when you press a button as I can't seem to find one or even know what it's called lol.
The last thing is I can't get the write() to do all 3 things in one line. I know there's a way to do something like write(ID, ": ", message) or even with print but every time I try it with , or . like it has it in the wiki it doesn't work for me.
term.clear()
rednet.open("back")
textutils.slowPrint ("rednet is starting...")
sleep (2)
local open = rednet.isOpen("back")
if open == true then
print("rednet started")
sleep (0.5)
print("now recieving messages")
sleep (0.5)
while true do
local ID, message, distance = rednet.receive()
write(ID)
write(": ")
write(message)
print()
end
else
print("rednet failed to start")
print("check modem and start again")
end