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

Door Lock

Started by palomitasygameplay, 21 February 2012 - 08:27 PM
palomitasygameplay #1
Posted 21 February 2012 - 09:27 PM
Hello, I was trying to edit the code of de door lock but,when I test the program, this say: invalid side :/

Can you give me your pass code and a picture of how the redstone place?
Espen #2
Posted 21 February 2012 - 09:48 PM
I think it would help if you could specify to whom you're actually talking to, so that we know to whose program you're referring to. :huh:/>/>
palomitasygameplay #3
Posted 22 February 2012 - 02:13 PM
http://www.computercraft.info/forums2/index.php?/topic/138-super-simple-door-lock/
Espen #4
Posted 22 February 2012 - 02:25 PM
Alright, thx for the clarification. Might've been better if you just posed your question there. <_</>/>
You have to configure his program before you can use it.
I.e. you have to replace all of these…
{LOCATION}
{PASSWORD}
{SIDE OF DOOR}
… with some values.
{LOCATION} can be replaced by anything, because that is only what is being printed on the screen.
{PASSWORD} you have to replace with the password you wish to use.
{SIDE OF DOOR} has to be replaced by one of these values: front, back, left, right, top, bottom.

Example:
Let's say you have a shed with a door.
Also, let's say the door of the shed is connected to the left side of the computer.
And let's say you want to use "secret" as your password.
Then the code could look like this:

local function clearScreen()
	term.clear()
	term.setCursorPos(1, 1)
end
while true do
	clearScreen()
	print ("Type password to enter the shed!")   -- Replaced {LOCATION} with 'the shed'
	if read("*") == "secret" then			-- Replaced {PASSWORD} with 'secret'
		clearScreen()
		print("Correct Password!")
		print("Open door for how long?")
		local a = read()
		clearScreen()
		print("Opening door!")
		sleep (1)
		redstone.setOutput("left", true)	-- Replaced {SIDE OF DOOR} with 'left'
		clearScreen()
		sleep (a)
	else
		clearScreen()
		print("Incorrect Password, please try again.")
		sleep (5)
	end
end
palomitasygameplay #5
Posted 23 February 2012 - 09:13 PM
and you can take a photo to look the circuit,please
Liraal #6
Posted 23 February 2012 - 09:55 PM
What circuit? You just place the computer by the door, on the right side of the door… It is that simple.
palomitasygameplay #7
Posted 23 February 2012 - 11:20 PM
ok, but the door, don't close :/
Espen #8
Posted 24 February 2012 - 01:32 AM
ok, but the door, don't close :/
Apparently TheNabwoodKidd uses the same code you did and had that very same question, hehe. ^_^/>/>
I answered him here: http://www.computercraft.info/forums2/index.php?/topic/181-what-am-i-doing-wrong/page__view__findpost__p__1125
palomitasygameplay #9
Posted 24 February 2012 - 03:13 PM
THANK, THANKS, THANKS X1000