Hello. I’m trying to make a safe with a keypad lock, i.e, you type “type 73836 on safe” and then the safe is unlocked. My code compiles but does not work as expected. It seems to have no idea what I mean by “the noun” in my if clauses, “type 73836 on safe” produces “You don’t know how to do that to nothing.” If anyone can point out any particular mistakes, I’d be grateful.
Your Bedroom is a room.
In Your Bedroom is a safe. It is a closed, locked, opaque container. The safe is scenery.
The description of the safe is "It's a small safe, about a cubic foot, with a keypad on the front, laid out the same as a cellphone keypad."
The safe has a number called the combo. When play begins, now the combo of the safe is 73836. Understand "keypad" as the safe.
Typing on it is an action applying to one number and one thing. Understand "type [a number] on [something]" as typing on it.
Check typing on it:
if the noun is not the safe:
instead say "You don't know how to do that to [the noun].";
if the noun is unlocked:
instead say "[The noun] is already unlocked."
Carry out typing on it:
if the number understood is the combo of the noun:
now the noun is unlocked;
Report typing on it:
if the noun is unlocked:
say "The lock clicks unlocked.";
otherwise:
say "You type the number on the keypad, but nothing happens."