It may be desirable to have different 'keys' in adventure maps which will only work in specific locks. This article describes one way to implement this.
This circuit uses a pre-programmed Memory Bank as a key. The lock circuit is also pre-programmed to accept only one certain key (or several specific keys). This lets the builder provide a number of keys which may or may not fit a variety of locks. You can have many locks which only work with their specified key. When programmed correctly, there could even be a 'master key' which fits all (or just some) of the locks.
Very Simple Lock Circuit
The requires only a single Battery.
As you can see, this is an extremely simple circuit. It can easily be hidden so the player will not even know it's there unless prompted. This circuit can be used in up to 16 distinct different locks. If you need more than that, use the circuit below.
It must be programmed with an 'F' placed in the proper location. Which location that is depends on the key to unlock it. The key will have only one location programmed and that with an 'F'. The battery voltage sets which location it looks at. If its voltage matches the programmed location, the bank outputs that 'F'.
The 'Full' Lock Circuit
The image below shows the full keylock circuit. It's laid out so you can see it all. In an adventure map, you would probably build it so the character cannot see the components.
This circuit lets you have up to thousands of different keys for that many different locks. If you don't need more than 16 different keys, you can use the above circuit.
The unlabelled Memory Bank is the 'key'. It would be pre-programmed with the proper code when the map is made. The other banks are the lock circuit.
The banks labelled 'High' and 'Low' set the address (in the key) where the code is set. The bank labelled 'Code' holds the lock code for that particular lock. This code is placed at 0,0 in this bank. The bank labelled 'Comp' is a standard compare circuit bank. See Memory_Bank#Analog_Comparator this page for the compare circuit description.
A very simple example is shown in this world.