Modified Lock-Unlock

version 2 by Al Golden

  • Home page
  • Complete text



  • Version 2 of Modified Lock-Unlock by Al Golden begins here.

    a thing can be open.
    a thing can be closed.
    a thing can be locked.
    a thing can be unlocked.
    a thing is either openable or unopenable.
    a thing is either lockable or unlockable.

    a thing is either matched or unmatched.
    a thing is usually unmatched.

    a thing is either key-required or nonkey-required.
    a thing is usually nonkey-required.

    a thing is usually unopenable.
    a thing is usually unlockable.

    rule for printing room description details: stop.

    understand the command "open" as something new.

    opening it with is an action applying to two things.
    understand "open [something] with [something]" as opening it with.
    understand "open [something]" as opening.

    understand the command "unwrap" as something new.
    unwrapping is an action applying to one thing.
    understand "unwrap [something]" as unwrapping.

    understand the command "uncover" as something new.
    understand "uncover [something]" as unwrapping.
    uncovering is an action applying to one thing.

    understand the command "lock" as something new.
    locking is an action applying to one thing.

    understand the command "unlock" as something new.
    unlocking is an action applying to one thing.

    understand "lock [something]" as locking.
    understand "unlock [something]" as unlocking.
    understand "lock [something] with [something preferably held]" as locking it with.
    understand "unlock [something] with [something preferably held]" as unlocking it with.

    before locking a locked thing with a second noun:
    say "[The noun] is already locked.";
    stop.

    before locking a locked thing:
    say "[The noun] is already locked.";
    stop.

    check unlocking an unlocked thing with a second noun:
    say "[The noun] is already unlocked." instead.

    check unlocking an unlocked thing:
    say "[The noun] is already unlocked." instead.

    check locking an unlockable thing:
    say "[The noun] is incapable of being locked." instead.


    check unlocking an unlockable thing:
    say "[The noun] is incapable of being unlocked." instead.

    before unlocking an unlockable thing with a second noun:
    say "[The noun] is incapable of being unlocked with [the second noun]." instead.

    before locking an unlockable thing with a second noun:
    say "[The noun] is incapable of being locked with [the second noun]." instead.

    check opening an unopenable thing:
    say "[The noun] is incapable of being opened." instead.

    check closing an unopenable thing:
    say "[The noun] is incapable of being closed." instead.


    before unlocking a key-required thing:
    if a matched thing is not carried by the player,
    say "You need a key in order to do that." instead.

    before unlocking a key-required thing with a second noun:
    if a matched thing is not carried by the player,
    say "You need a key in order to do that." instead.

    before locking a key-required thing:
    if a matched thing is not carried by the player,
    say "You need a key in order to do that." instead.

    before locking a key-required thing with a second noun:
    if a matched thing is not carried by the player,
    say "You need a key in order to do that." instead.

    report unwrapping something:
    say "You unwrap [the noun].".

    report uncovering something:
    say "You uncover [the noun].".

    before opening an unopenable thing with a second noun:
    say "The [noun] is incapable of of being opened with [the second noun]." instead.

    before opening an open thing with a second noun:
    say "The noun is already open." instead.

    instead opening a closed unlocked thing with a second noun:
    now the noun is open;
    say "You open [the noun] with [the second noun].".

    instead opening a closed locked thing with a second noun:
    if the second noun is not carried by the player begin;
    say "You need to take [second noun] before doing that.";
    otherwise;
    now the noun is unlocked;
    now the noun is open;
    say "You unlock and open [the noun] with [the second noun].";
    end if.

    instead opening a closed unlocked thing with a second noun:
    if the second noun is not carried by the player begin;
    say "You need to take the [second noun] before doing that.";
    otherwise;
    now the noun is unlocked;
    now the noun is open;
    say "You open [the noun] with [the second noun].";
    end if.

    before locking something with a second noun:
    if the second noun is the noun,
    say "You can't use [the second noun] to lock itself." instead.

    before unlocking something with a second noun:
    if the second noun is the noun,
    say "You can't use [the second noun] to unlock itself."

    instead of locking an unlocked lockable thing:
    if the noun is open begin;
    now the noun is closed;
    now the noun is locked;
    say "You close and lock [the noun].";
    otherwise;
    now the noun is locked;
    say "You lock [the noun].";
    end if.

    instead of locking an unlocked lockable thing:
    now the noun is locked;
    say "You lock [the noun].".

    before locking a locked lockable thing with a second noun:
    say "[The noun] is already locked." instead.

    instead of locking an unlocked lockable thing with a second noun:
    if the second noun is matched begin;
    now the noun is locked;
    say "You lock [the noun] with [the second noun].";
    otherwise;
    say "[The second noun] does not lock [the noun].";
    end if.

    instead of unlocking a locked lockable thing:
    if the noun is key-required begin;
    say "You need something to do that with.";
    otherwise;
    now the noun is unlocked;
    say "You unlock [the noun].";
    end if.

    instead of unlocking a locked thing with a second noun:
    if the second noun is matched begin;
    now the noun is unlocked;
    say "You unlock [the noun] with [the second noun].";
    otherwise;
    say "[The second noun] does not unlock [the noun].";
    end if.
        
    instead of unlocking a key-required thing:
    if a matched thing is carried by the player begin;
    now the noun is unlocked;
    say "You unlock [the noun].";
    otherwise;
    say "You need something to unlock [the noun] with.";
    end if.

    instead of locking a key-required thing:
    if a matched thing is carried by the player begin;
    now the noun is locked;
    say "You lock [the noun].";
    otherwise;
    say "You need something to lock [the noun].";
    end if.


    Modified Lock-Unlock ends here.