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

Password Doors

Started by jewelshisen, 24 January 2013 - 07:34 AM
jewelshisen #1
Posted 24 January 2013 - 08:34 AM
Ok I have found a small thing I am curious about fixing. I have password locked doors but want the program to basically make the player exit the gui after entering the correct password so they can go through the door. Is there a way to do this?
ChunLing #2
Posted 24 January 2013 - 09:06 AM
You mean automatically close the console? Hmm…I'm not aware of one.
theoriginalbit #3
Posted 24 January 2013 - 09:31 AM
Ok I have found a small thing I am curious about fixing. I have password locked doors but want the program to basically make the player exit the gui after entering the correct password so they can go through the door. Is there a way to do this?
Have the console just in reach then moved away with rp2 frames should close the GUI. Then when the door is closed, move it back into position.
jewelshisen #4
Posted 24 January 2013 - 12:30 PM
Ok I have found a small thing I am curious about fixing. I have password locked doors but want the program to basically make the player exit the gui after entering the correct password so they can go through the door. Is there a way to do this?
Have the console just in reach then moved away with rp2 frames should close the GUI. Then when the door is closed, move it back into position.

That wont' work because I have the computer keeping the door open. The moment you move the computer it would shut the door.
NeverCast #5
Posted 24 January 2013 - 12:32 PM
Unless you hold it open with RedPower or another computer.

Use a RP RS latch + Timer

When the door is closed, the timer is held stopped by an inverted signal from the door
When the door is opened, the latch is toggled, the timer starts.
When the timer pulses, it pulses the Reset on the latch, closing the door and holding the timer again.

I think another computer with Rednet is probably easier though :P/>

Also means if someone hacks your computer, they haven't hacked your door!
Zambonie #6
Posted 24 January 2013 - 01:48 PM
One way I basicly I use to it,is to type:

shell.run("shutdown")
Since my pass door program is in the startup,when ever you turn it on,it will start the program.Although,if you want it to basicly just go back to the shell,then use this code:

shell.run("shell")
shell.run("") basicly runs the program that you want to.Just put the program in between the "" and when it reaches to that point,it will run it.For the program your writing,heres an example on how to use it:

local input = read("*") -- Use "*" only if you want to display the text
--like that to hide your pass.
if input == "Whatever pass here" then
-- Do stuff to open and close door.
--Just a hint.Use sleep() anywere in between to the code to open
--and close the door.It will make sure that the comp wont shutdown
--without closing the door.
shell.run("shutdown") -- or "shell"
end
Cranium #7
Posted 24 January 2013 - 01:54 PM
Just do a normal password input then add this:

while true do
  local events = {os.pullEvent()}
  if events[1] == "key" and events[2] == 1 then
    sleep(1)  -- this will wait for them to walk to the door
    --add redstone signal here
    sleep(1)
    --stop redstone signal here
    break
  end
end
os.reboot()
This will wait until a user presses 'escape' and then it will break the loop, then restart the computer.
anonimo182 #8
Posted 24 January 2013 - 01:56 PM
Or you could make a turtle to destroy the computer, then placing it again
NeverCast #9
Posted 24 January 2013 - 02:03 PM
Just do a normal password input then add this:

... all the code ..
This will wait until a user presses 'escape' and then it will break the loop, then restart the computer.

Thought I read that the Escape key was no longer forwarded to the program, Is this a lie?
theoriginalbit #10
Posted 24 January 2013 - 02:04 PM
No escape is no longer sent to the program… *searches for link where I asked Cloudy if it still was*

Comment #15 to the end http://www.computercraft.info/forums2/index.php?/topic/8614-fullscreen-mode/
Edited on 24 January 2013 - 01:07 PM
NeverCast #11
Posted 24 January 2013 - 02:08 PM
A user in a PM recently sent me a message regarding this…
This'll be fun! Wonder how long before he notices it doesn't work.
theoriginalbit #12
Posted 24 January 2013 - 02:09 PM
Hopefully he was using an old version which DOES do it :P/>
jewelshisen #13
Posted 24 January 2013 - 02:13 PM
Using the latest CC and I am just giving on this one. Thanks anyways.
NeverCast #14
Posted 24 January 2013 - 02:15 PM
Yes indeed it does :D/>
In which case he's probably using a 1.2.5 version of Tekkit..

So I don't want to help him now :P/>
theoriginalbit #15
Posted 24 January 2013 - 02:15 PM
Using the latest CC and I am just giving on this one. Thanks anyways.
This is a plausible solution, as long as the computer is labelled or a disk drive attached to it… combined with some kind of rs latch
Or you could make a turtle to destroy the computer, then placing it again
jewelshisen #16
Posted 24 January 2013 - 02:29 PM
Not looking to have to either replace computers or hide a disk drive. Was looking for a code fix.
ChunLing #17
Posted 24 January 2013 - 08:12 PM
Well, there was a code fix of sorts, but it was deliberately removed. I somewhat understand the reasoning behind that decision.