Posted 28 October 2012 - 09:29 PM
So I've been working on a login system for my computer, because i'm going to port my world to a server for me and my friends to play on, and the computer was also going to control a door next to the computer that led to a storage room.
So I figured that after asking for the login password, it would then ask if you wanted to enter the door to the left, and if you said no, it would open up to the rest of the computer, and if you said yes, it would initiate a door opening sequence and then return to the main computer. I before had decided that after getting into the program, you could just run a program that entered the door, but then it wouldn't be hidden by using the asterisk string, input = read("*") so I tried making a if statement after a if statement, it looked a little like this:
print("Welcome, please enter you're password:")
input = read("*")
if input == "HelloWorld" then
print("Password accepted, access granted.")
sleep(1)
print("Welcome rudemario, if you need to open the door to the left, please enter the correct password now:")
else
print("Password Incorrect, Access Denied."
sleep(1)
print("Initiating System Shutdown…")
sleep(1)
textutils.slowPrint("Goodbye!")
os.shutdown()
end
input = read("*")
if input == "creeperface" then
print("Password Accepted, Please Proceed.")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
print("Door now closed, enter the override code now to re-open the door.")
else
print("Welcome, rudemario.")
end
I have also tried to make the if statement inside of the if statement, and logically thats how it would go, right?
so now i'm at a stalemate, confused and frustrated, I request you're friendly community's help :/
So I figured that after asking for the login password, it would then ask if you wanted to enter the door to the left, and if you said no, it would open up to the rest of the computer, and if you said yes, it would initiate a door opening sequence and then return to the main computer. I before had decided that after getting into the program, you could just run a program that entered the door, but then it wouldn't be hidden by using the asterisk string, input = read("*") so I tried making a if statement after a if statement, it looked a little like this:
print("Welcome, please enter you're password:")
input = read("*")
if input == "HelloWorld" then
print("Password accepted, access granted.")
sleep(1)
print("Welcome rudemario, if you need to open the door to the left, please enter the correct password now:")
else
print("Password Incorrect, Access Denied."
sleep(1)
print("Initiating System Shutdown…")
sleep(1)
textutils.slowPrint("Goodbye!")
os.shutdown()
end
input = read("*")
if input == "creeperface" then
print("Password Accepted, Please Proceed.")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
print("Door now closed, enter the override code now to re-open the door.")
else
print("Welcome, rudemario.")
end
I have also tried to make the if statement inside of the if statement, and logically thats how it would go, right?
so now i'm at a stalemate, confused and frustrated, I request you're friendly community's help :/