Hello, i need some help to password protect my doors, i've tried to watch videos but none of the programs seem to work, i would very much apreciate the help, if you could write how to do it.
Hello, i need some help to password protect my doors, i've tried to watch videos but none of the programs seem to work, i would very much apreciate the help, if you could write how to do it.
If I can work out a way to extract it from my server at home without needing to type the whole thing out again I will post a couple of simple scripts I wrote to password protect a terminal. It can also be used with "open" and "close" commands to operate a door connected to the terminal. It's what I used on my original Nuclear reactor to make sure nobody messed with my setup.
Currently it does not have termination protection as I have never needed to secure it to that level.
make sure you write this in LUA and you save it.Code:while true do os.pullEvent =os.pullEventRaw term.clear() term.setCursorPos(1, 1) write("Please Enter Password: ") input = read("*") if input == "Password" then redstone.setOutput("right", true) sleep(3) redstone.setOutput("right", false) sleep(1) os.reboot() else print("Incorrect! Try again later.") sleep(1) print("Shutting Down") sleep(1) os.reboot()
Lot's of great programs over at http://www.computercraft.info/forums2/
That's where I got this. Credit to Hancomat55
I use the same code as posted above^
make sure you change the line
redstone.setOutput("right", true)
if you need it on the left of the computer or whatever you need... you will also need to change the line below it to close the door... you can take this a step further if you'd like and change the password from "Password" to what you want.. and change things like the time the door stays open "sleep(3)"
those computercraft forums are very helpful, i was writing a program to run my quarries and water pumps remotely and they helped me solve a few small errors
hey huys thank you very much for the help, and the tweaks, keep on posting things about computercraft, like bugs that we should be aware off, or if you have found some new way to program stuff.
once again thank you guys for the help.
---------- Post added 2012-10-19 at 01:28 PM ----------
How do i save stuff in LUA?
Last edited by mmoce16247c182; 2012-10-19 at 11:28 AM.
Gah, sorry dude completely forgot about this last night. Will try to remember to do it later.
My script (technically 3 scripts that work together) is different from the one posted above in that mine allows for multiple attempts (3) before shutting down the OS and still functions as a regular terminal once you have entered your password. You then type "open" or "close" to operate the door (or sticky piston based security). Instead of automatically closing the door behind you, mine waits for you to type "close". The reason for this was that mine is intended to protect a reactor which is in a "room" full of water that you can't actually walk into.
On a different note, programming LUA is surprisingly easy thanks to google and making a script do exactly what you want is incredibly rewarding. I'd highly recommend spending an hour or two poking around with some code to see if it begins to make more sense.
spambanjo could you please link me to the site where i can do that
and thank you fuzzzie
I didn't forget about you dude, but it seems my local copy of my server is older than I thought, as it doesn't have a terminal in the nuclear reactor building on my most recent version. I'll speak to our hosting company at some point and get FTP access to our live version of the server (I need to have a recent local backup of the current files anyway)... so I'll grab the script then.
i seem to have troubles with the codes that you have given me, i can't make them work for some reason, even though i have writen exactly what you wrote, any suggestions to that guys?