This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Jester's profile picture

Door system double conditional

Started by Jester, 17 May 2016 - 05:31 PM
Jester #1
Posted 17 May 2016 - 07:31 PM
CODE DELETED
Edited on 29 May 2016 - 04:01 PM
TYKUHN2 #2
Posted 17 May 2016 - 07:50 PM
End it before the second conditional. Also the conditionals can contain the code you want to run itself.

if user == "username" and pass == "123" then
    term.clear()
    term.setCursorPos(14,8) 
    print("Authentication Successful")
    rs.setOutput(side, true)
    sleep(5)
    term.clear()
    sleep(3)
    os.reboot()
elseif user == "BYPASS" and pass == "RESET" then
    term.clear()
    term.setCursorPos(14,8) 
    print("LOL")
    rs.setOutput(side, true)
    sleep(5)
    term.clear()
    sleep(3)
    os.reboot()
else
    term.clear()
    term.setCursorPos(14,8) 
    print("Password not Recognised")
    sleep(5)
    os.reboot()
end
Jester #3
Posted 18 May 2016 - 12:33 PM
Ooh thanks.

Is there anyway to replace the "text show: lol" with a termination of the whole program,
which will bring me back to console and break the loop untill a next reboot.

example:

elseif user == "BYPASS" and pass == "RESET" then
    term.clear()
    [ INSERT CODE TO TERMINATE THE PROGRAM AND RETURN TO THE CONSOLE]
    sleep(3)
    os.reboot()
Edited on 18 May 2016 - 10:35 AM
Bomb Bloke #4
Posted 18 May 2016 - 05:04 PM
Just delete the os.reboot() call.