Ok I just played around a bit with modems and stuff (never used them before xD) and I think I figured out how to do this..
So for the master computer edit startup and put this code there (ill try to explain it), also put a modem on top of it. Also there are a couple of variations on the password system and menu but I used the most simple ones here.
jail = {3,4,5} --put the computer id's of the jail pc's in that table, starting with the first jail
rednet.open("top")
term.clear()
term.setCursorPos(2,3)
write("Enter password: ")
pass = read()
if pass == "nyan" then --nyan is the password here
sleep(0.25) -- just so it looks a bit nicer
term.clear()
term.setCursorPos(2,3)
write("What do you want to do?")
term.setCursorPos(2,4)
command = read()
if command == "open" then
term.setCursorPos(2,5)
write("Open jail nr.: ")
x = read() --make sure to type a number here or it will crash
if jail[x] then --if jail number x exists
rednet.send(jail[x],"open")
end
elseif command == "close" then
term.setCursorPos(2,5)
write("Close jail nr.: ")
y = read() --make sure to type a number here or it will crash
if jail[y] then --if jail number y exists
rednet.send(jail[y],"close")
end
end
else -- if the password was incorrect
os.reboot()
end
now for the jail pc's add this code
mainpc = 1 --This should be the ID of the main pc
timeout = 0.5 --timeout time for timer
gtID = nil --
while true do
gtID = os.startTimer(timeout)
ev,p1 = os.pullEvent()
if ev == "timer" and p1 == gtID then
local rID,msg = rednet.receive(5)
if rID == mainpc then
if msg == open then
rs.setOutput("right",true) --if the jaildoor is to the right of the pc
elseif msg == close then
rs.setOutput("right",false)
end
end
elseif ev == "key" then
term.setCursorPos(2,3)
write("Password: ")
pass = read()
if pass == "nyan" then
term.setCursorPos(2,4)
write("What do you want to do?")
command = read()
if command == "open" then
rs.setOutput("right",true)
sleep(5) --after 5 seconds door closes again
rs.setOutput("right",false)
end
else -- if the password was wrong
os.reboot()
end
end
end
I did not test this code so i dont know if it works, but you should be able to fix it and make it better looking..