Talk:Tutorial/Easy Passworded Door/@comment-173.0.44.254-20121205025705

The syntax on the program is off slightly. If you type it in exactly as it is, it won't reboot the computer if you put in the correct password. To fix this, put the "end" before the sleep(3) command or put another sleep(3) and os.reboot before the "else". The way it is written tells it to reboot if the password was wrong. Moving the "end" command tells it to reboot no matter if the password was right or wrong or you can tell it to reboot with the correct password along with the incorrect one. Making the program look like this works:

term.clear term.setCursorPos(1, 1) print("Simple Password Door v. 1.0") write("Enter password: ") input = read password = "Tekkit" if input == password then print("Password was correct!") rs.setOutput("left", true) sleep(3) rs.setOutput("left", false) sleep(3) os.reboot else print("Password was incorrect") sleep(3) os.reboot end or

term.clear term.setCursorPos(1, 1) print("Simple Password Door v. 1.0") write("Enter password: ") input = read password = "Tekkit" if input == password then print("Password was correct!") rs.setOutput("left", true) sleep(3) rs.setOutput("left", false) else print("Password was incorrect") end sleep(3) os.reboot