A safe with a multi-number combination, meant to be dialed over multiple turns, is implemented using a log of the last three numbers dialed. The log can then be compared to the safe's correct combination.

It is not difficult to implement a safe which can be set to a single number to open; but a more common scenario in the real world is for the safe to open on a sequence of numbers when they have been dialed in the right order.

For IF, this means that we have to keep running track of the last N digits the player has dialed, dropping the first digit and adding a new one to the end each time the player re-dials the safe. This is a perfect occasion for lists:

"Eyes, Fingers, Toes"
The Addams Wine Cellar is a room. It contains a closed lockable locked container called a safe.
The safe has a list of numbers called the current combination.
The safe has a list of numbers called the true combination. The true combination of the safe is {2, 10, 11}.
Understand "set [something] to [a number]" as setting it numerically to. Setting it numerically to is an action applying to one thing and one number.
Instead of examining the safe:
   if the number of entries in the current combination of the safe is 0,
      say "You haven't dialed the safe to any combination yet.";
   otherwise say "You have dialed the safe to [the current combination of the safe].".
Check setting something numerically to (this is the block setting numerically rule):
   say "[The noun] cannot be set."
Instead of setting the safe numerically to the number understood:
   truncate the current combination of the safe to the last 2 entries;
   add the number understood to the current combination of the safe;
   if the safe is locked and the current combination of the safe is the true combination of the safe:
      say "You dial [the number understood], and [the safe] gives a joyous CLICK.";
      now the safe is unlocked;
   otherwise if safe is unlocked and the safe is closed and the current combination of the safe is not the true combination of the safe:
      say "You spin the dial, and [the safe] snicks locked.";
      now the safe is locked;
   otherwise:
      say "You dial [the number understood] on the safe."
Test me with "x safe / set safe to 10 / x safe / set safe to 29 / x safe / set safe to 2 / x safe / set safe to 10 / x safe / set safe to 11 / open safe / set safe to 14 / close safe / set safe to 15 / open safe".
Test me with "x safe / set safe to 10 / x safe / set safe to 29 / x safe / set safe to 2 / x safe / set safe to 10 / x safe / set safe to 11 / open safe / set safe to 14 / close safe / set safe to 15 / open safe".
Addams Wine Cellar
You can see a safe (closed) here.

>(Testing.)

>[1] x safe
You haven't dialed the safe to any combination yet.

>[2] set safe to 10
You dial 10 on the safe.

>[3] x safe
You have dialed the safe to 10.

>[4] set safe to 29
You dial 29 on the safe.

>[5] x safe
You have dialed the safe to 10 and 29.

>[6] set safe to 2
You dial 2 on the safe.

>[7] x safe
You have dialed the safe to 10, 29 and 2.

>[8] set safe to 10
You dial 10 on the safe.

>[9] x safe
You have dialed the safe to 29, 2 and 10.

>[10] set safe to 11
You dial 11, and the safe gives a joyous CLICK.

>[11] open safe
You open the safe.

>[12] set safe to 14
You dial 14 on the safe.

>[13] close safe
You close the safe.

>[14] set safe to 15
You spin the dial, and the safe snicks locked.

>[15] open safe
It seems to be locked.