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

Basic computer/door lock

Started by AnDwHaT5, 24 November 2012 - 08:04 AM
AnDwHaT5 #1
Posted 24 November 2012 - 09:04 AM
This is a quick easy computer/door protection system i made.
the files are very configurable and user friendly with step by step instructions perfect for someone that dosnt know anything or next to nothing about computer craft. If i forgot something tell me please and i will revise. ;)/>/>
Tiin57 #2
Posted 24 November 2012 - 09:58 AM
Please move this to Programs. It doesn't belong in Ask a Pro.
overfritz #3
Posted 24 November 2012 - 11:26 AM
TBH seems like just about every other door code out there…not like its easy to make a new door lock thats 120% different.
Looking through it, I also noticed that there is no part that actually can access the computer terminal. This means should there be an issue with the password, or you can't remember it, you have no access to the terminal to remember it. There's also no harm in having the rs. code be actual code, as long as there's nothing hooked up there. Then you can just leave it. I've cleaned it up a bit, making the commenting go with each line of code, instead of having to make the user refer back to the top to see what it means.

--This is a basic lock created by AnDwHaT5

--Settings
local pass = "password" --Change this to your password.
local dpass = "debug" --Change this to a debuging code, never share it!
local open = 0 --Replace 0 with a value for the door/PC wait time
local open2 = 0 --Replace 0 with a value for the reboot time (time until reboot). Recomended to be .5 -> 2.

os.pullEvent = os.pullEventRaw
term.clear() --dont config term.clear()
print("This 'system' is locked by [USER]") --Replace 'system' if you want, [USER] is your name.
write("Password: ")
input = read("*")
if input == pass then
print("Welcome [USER]") --Replace [USER] with your name.
redstone.setOutput("side", true) --Replace "side" with the door side (based on PC)
sleep(open) ---Do not change this here, change it up there.
redstone.setOutput("side", false) --Replace "side" with the door side (based on PC)
term.clear()
term.setCursorPos(1,1)
print("CraftOS 1.4")
sleep(open2)
--os.reboot <-Uncomment that if you want a door lock and comment 'print("CraftOS 1.4")'.
else
print("Wrong password")
sleep(open2)
os.reboot()
end

You also forgot to put in "end" at the, well, end of the code. Otherwise it won't work. Ever. Feel free to use that code above too if you like.