Posted 10 May 2012 - 11:45 AM
Hi what i am trying to do is have my master computer open all the doors on a rednet signal, but as well have the computer being able to open the door separately.
This is the Code for the Master Computer, it does Work but any modification u make will help.
print(" Username correct ")
sleep(sleepTime2)
write(" Enter password: ")
inputPass = read("*")
if inputPass == pass then
print(" Password Correct ")
sleep(sleepTime2)
rednet.broadcast("OPEN")
sleep(sleepTime3)
print(" Working ")
rednet.close("back")
elseif inputPass ~= pass then
print(" Password incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
end
end
function UserIncorrect()
if inputUser ~= user then
print(" Username incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
end
end
function BackArea()
if inputUser == backarea then
print(" Opening Door! ")
print(" Please Wait ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Door Open ")
sleep(sleepTime1)
rs.setOutput("left", true)
sleep(sleepTime2)
rs.setOutput("left", false)
print(" Door Closed. Thanks you! ")
print(sleepTime2)
end
end
function AccessToAllRooms()
if inputUser == allRooms then
rednet.open("back")
rednet.send(5,"OpenDoor")
rednet.send(7,"OpenDoor")
print(" Message Sent ")
rednet.close("back")
end
end
sleepTime1 = 3
sleepTime2 = 2
sleepTime3 = 3
sleepTime4 = 1
sleepTimeTest = 5
user = "jamesscape2"
pass = "basketball"
backarea = "OpenDoor"
allRooms = "AuthOnly"
term.clear()
term.setCursorPos(1,1)
print(" ———————————")
print(" - Welcome to the Master Control -")
print(" ———————————")
sleep(sleepTime1)
write(" Enter username: ")
inputUser = read("*")
if inputUser == user then
UserCorrect()
elseif
inputUser == backarea then
BackArea()
elseif
inputUser == allRooms then
AccessToAllRooms()
else
UserIncorrect()
end
sleep(5) – set to 20 later on
term.clear()
os.reboot()This the code for the room which i want the master computer to open
print(" Username correct ")
sleep(sleepTime2)
write(" Enter password: ")
inputPass = read("*")
if inputPass == pass then
print(" Password Correct ")
sleep(sleepTime2)
rs.setOutput("left", true)
print(" Welcome Enter ")
sleep(sleepTime3)
rs.setOutput("left", false)
elseif inputPass ~= pass then
print(" Password incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function UserIncorrect()
if inputUser ~= user then
print(" Username incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function OpenDoor()
x,y,z=rednet.receive()
if y=="OpenDoor" then
rs.setOutput("left", true)
sleep(3)
rs.setOutput("left", false)
end
end
function Opening()
if inputUser == user then
UserCorrect()
else
UserIncorrect()
end
end
sleepTime1 = 3
sleepTime2 = 2
sleepTime3 = 3
sleepTimeTest = 5
user = "Override"
pass = "Override"
term.clear()
term.setCursorPos(1,1)
print(" ——————————- ")
print(" -Welcome to the Override Room-")
print(" ——————————- ")
sleep(sleepTime1)
rednet.open("right")
write(" Enter username: ")
inputUser = read("*")
Opening()
parallel.waitForAny(OpenDoor(), Opening())
os.reboot()
i know there is a problem but i dont know how to fix it. but any modification u make will help
Please HELP
thanks
This is the Code for the Master Computer, it does Work but any modification u make will help.
Spoiler
function UserCorrect()print(" Username correct ")
sleep(sleepTime2)
write(" Enter password: ")
inputPass = read("*")
if inputPass == pass then
print(" Password Correct ")
sleep(sleepTime2)
rednet.broadcast("OPEN")
sleep(sleepTime3)
print(" Working ")
rednet.close("back")
elseif inputPass ~= pass then
print(" Password incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
end
end
function UserIncorrect()
if inputUser ~= user then
print(" Username incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
end
end
function BackArea()
if inputUser == backarea then
print(" Opening Door! ")
print(" Please Wait ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Door Open ")
sleep(sleepTime1)
rs.setOutput("left", true)
sleep(sleepTime2)
rs.setOutput("left", false)
print(" Door Closed. Thanks you! ")
print(sleepTime2)
end
end
function AccessToAllRooms()
if inputUser == allRooms then
rednet.open("back")
rednet.send(5,"OpenDoor")
rednet.send(7,"OpenDoor")
print(" Message Sent ")
rednet.close("back")
end
end
sleepTime1 = 3
sleepTime2 = 2
sleepTime3 = 3
sleepTime4 = 1
sleepTimeTest = 5
user = "jamesscape2"
pass = "basketball"
backarea = "OpenDoor"
allRooms = "AuthOnly"
term.clear()
term.setCursorPos(1,1)
print(" ———————————")
print(" - Welcome to the Master Control -")
print(" ———————————")
sleep(sleepTime1)
write(" Enter username: ")
inputUser = read("*")
if inputUser == user then
UserCorrect()
elseif
inputUser == backarea then
BackArea()
elseif
inputUser == allRooms then
AccessToAllRooms()
else
UserIncorrect()
end
sleep(5) – set to 20 later on
term.clear()
os.reboot()
Spoiler
function UserCorrect()print(" Username correct ")
sleep(sleepTime2)
write(" Enter password: ")
inputPass = read("*")
if inputPass == pass then
print(" Password Correct ")
sleep(sleepTime2)
rs.setOutput("left", true)
print(" Welcome Enter ")
sleep(sleepTime3)
rs.setOutput("left", false)
elseif inputPass ~= pass then
print(" Password incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function UserIncorrect()
if inputUser ~= user then
print(" Username incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function OpenDoor()
x,y,z=rednet.receive()
if y=="OpenDoor" then
rs.setOutput("left", true)
sleep(3)
rs.setOutput("left", false)
end
end
function Opening()
if inputUser == user then
UserCorrect()
else
UserIncorrect()
end
end
sleepTime1 = 3
sleepTime2 = 2
sleepTime3 = 3
sleepTimeTest = 5
user = "Override"
pass = "Override"
term.clear()
term.setCursorPos(1,1)
print(" ——————————- ")
print(" -Welcome to the Override Room-")
print(" ——————————- ")
sleep(sleepTime1)
rednet.open("right")
write(" Enter username: ")
inputUser = read("*")
Opening()
parallel.waitForAny(OpenDoor(), Opening())
os.reboot()
i know there is a problem but i dont know how to fix it. but any modification u make will help
Please HELP
thanks