Posted 03 March 2014 - 04:05 AM
Hey guys im pretty new to computercraft so this is going to likely be a simple question. I've been learning by reading other peoples codes and trying to understand why and what things do. I used someone elses code to make a door lock and it was very simple and worked just fine. I can edit it when you hold ctr-T and what i want to do is make a second password that allows acces to the terminal instead of turning off the computer.Here is the code i have in the computer
–Startup–
textutils.slowPrint("Enter Password")
password = read("*")
if password == "password" then
print("Password Accepted")
redstone.setOutput9"back", true)
sleep(5)
redstone.setOutput("back", false)
sleep(2)
os.shutdown()
end —this is where the original code ended
elseif password == "unlock" then —-this is the part i tried to add
print("Terminal Access Granted")
sleep(1)
end
end
if someone can explain whats wrong as well as why its wrong that would be great. I cant wait to learn more about the coding. Any other suggestions and explanations are welcome.
Also i had to type the code in here manually. Is there a way to copy and paste the code from tekkit so i dont have to retype it?
–Startup–
textutils.slowPrint("Enter Password")
password = read("*")
if password == "password" then
print("Password Accepted")
redstone.setOutput9"back", true)
sleep(5)
redstone.setOutput("back", false)
sleep(2)
os.shutdown()
end —this is where the original code ended
elseif password == "unlock" then —-this is the part i tried to add
print("Terminal Access Granted")
sleep(1)
end
end
if someone can explain whats wrong as well as why its wrong that would be great. I cant wait to learn more about the coding. Any other suggestions and explanations are welcome.
Also i had to type the code in here manually. Is there a way to copy and paste the code from tekkit so i dont have to retype it?