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

Password door errors

Started by Mytherals, 18 May 2014 - 09:40 PM
Mytherals #1
Posted 18 May 2014 - 11:40 PM
I began making a password door that allows multiple users to access using different passwords and an admin password that unlocks the computer.
I'm am using Tekkit Classic with Computercraft V1.33. Strings 21, 31, and 41 give invalid side. I can't seem to fix it, need help thanks.

os.pullEvent = os.pullEventRaw
local side = "back"
local password1 = "test1"
local password2 = "test2"
local password3 = "test3"
local passwordadmin = "admin"
term.clear()
sleep(1)
print("Loading...")
sleep(2)
print("Myth Lock v1.0 Loaded")
print("Welcome to the safe.")
print("To continue please enter password.")
write("Password: ")
local input = read("*")
if input == password1 then
   term.clear()
   term.setCursorPos(1,1)
   print("Password correct!")
   print("Welcome Bob")
   rs.setOutput("back,true")
   sleep(4)
   rs.setOutput("back,false")
   os.reboot()
end
if input == password2 then
   term.clear()
   term.setCursorPos(1,1)
   print("Password correct!")
   print("Welcome Bill")
   rs.setOutput("back,true")
   sleep(4)
   rs.setOutput("back,false")
   os.reboot()
end
if input == password3 then
   term.clear()
   term.setCursorPos(1,1)
   print("Password correct!")
   print("Welcome Jack")
   rs.setOutput("back,true")
   sleep(4)
   rs.setOutput("back,false")
   os.reboot()
end
if input == passwordadmin then
   term.clear()
   term.setCursorPos(1,1)
   print("Password correct!")
   print("Computer unlocking...")
   print("Please type 'reboot' or 'shutdown' before leaving")
   os.pullEvent(terminate)

else
   term.clear()
   term.setCursorPos(1,1)
   print("Password incorrect!")
   sleep(2)
   os.reboot()
end
Edited on 18 May 2014 - 09:47 PM
Minion #2
Posted 19 May 2014 - 01:51 AM
try

rs.setOutput("side", bool)

ex: rs.setOutput("top", true)

when you have it inside quotations it's interpreted as a string, so having true/false will be read as a string and not a Boolean value

*shrugs*