https://s3-us-west-2.amazonaws.com/secure.notion-static.com/665cfa2c-a40a-4bc3-ad61-cfc0a87dfe2c/03-open_door.png

What you’ll learn:

Basic Minecraft lets you use Redstone to create cool and complex circuits. With the addition of a computer, we can make things more interesting. Using an Advanced Computer, we’ll create a door lock that asks for a password

-- Password protected door lock
-- Use a computer to password protect your base!
-- Jim Christian
-- Coding in Minecraft

-- start the main loop
while true do
	-- clear the screen
	term.clear()
	-- set the position of the cursor
	term.setCursorPos(1, 1)
	-- print a prompt to the screen and mask the input with an asterisk
	print("Input the password.")
local input = read("*")
	-- check the input variable vs the actual password
	if input == "dinnerbone" then
		-- let the player know that they're correct
		print("Correct.")
		-- output a Redstone signal to the right of the computer
		redstone.setOutput("right", true)
		-- wait five seconds
		sleep(5)
		-- end Redstone signal output
		redstone.setOutput("right", false)
		-- end the loop
		break
	-- check if the password entered is incorrect
	elseif input ~= "dinnerbone" then
		-- clear the terminal
		term.clear()
		--set the cursor position
		term.setCursorPosition(1, 1)
		-- display an error message
		print("Error!")
		-- break the loop and end the program
	-- end the if statement	
	end
-- end the while loop
end