I'm bored and I've recent set this up. For this setup, you're going to need three computers, two modems, a disk drive, and a floppy disk.
Computer 1This computer accepts the password. It will have one of the two modems. Somewhere in your code there should be an if else statement, where the if handles if the password is correct and the else handles if it is incorrect. Add this somewhere into the if statement:
rednet.open("<side>") --where <side> represents whichever side the modem is on (acceptable input for this would be left, right, top, bottom, or back)
time = textutils.formatTime(os.time(),true)
message = "Access denied at "..time
rednet.send(<id2>, message) --where <id2> represents the id of Computer 2; you can discern this by running id on Computer 2
sleep(1) --keep in mind that unless you put this after the line that closes the door, this will affect how long the door is open
rednet.close("<side>") --has to be same as whichever side you opened
You may also choose to add this to the else statement:
rednet.open("<side>") --as before, whichever side the modem is on
time = textutils.formatTime(os.time(),true)
message = "Access denied at "..time.." with "..<attempt> --where <attempt> represents whichever variable you used to read the password
rednet.send(<id2>, message) --again, id of Computer 2
sleep(1)
rednet.close("<side>") --as before, has to be same as side you opened
Computer 2This computer will be two blocks from Computer 3, with the disk drive between the two and touching both. The floppy disk will obviously be in the drive. Computer 2 will have the second modem. It simply acts as a listener, waiting to receive messages from Computer 1. This is a simple listener program:
while true do
id,message = rednet.receive()
if id == <id1> then --where <id1> represents the id of Computer 1
file = io.open("/disk/<logs>", "a") --where <logs> represents some blank program that you saved on the disk in the adjacent disk drive's disk
file:write(message)
file:close()
end
end
Computer 3This is the computer you will be using to view the logs. As before, this needs to be adjacent to the disk drive, which is also adjacent to Computer 2. Here is a simple viewer program:
io.open("/disk/<logs>", "r") --again, <logs> being the blank program on the disk
Logs = {}
count = 0
for line in file:lines() do
if line ~= "" then --for whatever reason, any time you physically edit the /disk/<logs> file, it will add a blank line when you save and exit; this line ignores those
table.insert(Logs, line)
count = count + 1
end
end
loop = "yes"
while loop == "yes" do
print("There are ",count," logs.")
write("Which log would you like to view: ")
view = io.read()
if view < count + 1 then
print(Logs[view])
loop = "no"
else
print("Invalid entry. Please try again.")
end
end
I've thrown this together somewhat on the spot, so there may be some basic errors in there, but this should convey the idea behind how to set up what you're looking for.