tMsgs = {
["PCFound"] = "Connected to PC with ID: ",
["PCNotFound"] = "Unable to connect to PC with ID: ",
}
function cls(x,y)
term.clear()
term.setCursorPos(x,y)
end
rednet.open("top")
while true do
repeat
cls(1,1)
write("Enter the ID of the computer you would like to interact with: ")
cID = tonumber(read())
until type(cID) == "number"
print("\nAttemping to connect to PC with ID: "..cID)
sleep(3)
rednet.send(cID,"test")
os.startTimer(0.1)
event, sID, msg, dist = os.pullEvent()
cls(1,1)
if event == "timer" then
print(tMsgs["PCNotFound"]..cID)
elseif event == "rednet_message" then
if msg == "true" then
print(tMsgs["PCFound"]..cID)
end
else print("Event: "..event)
end
sleep(3)
end