I thought the easiest way to do this would be to make the keyring a
supporter with a BEFORE [; Receive: ... ; ], routine that would disallow
anything other than a key that a player tried to put on it. The only
problem is, the library rules say you can't put an object on a supporter
when you're carrying that supporter; the game returns the message "You
lack the dexterity." (Which frankly SUCKS as a library message, by the
way.) Also, whenever you try to unlock anything with a key on the
keyring, the game automatically attempts to take the keys.
I've tried add_to_scope as well, but that's causing a whole slew of
other problems, mostly having to do with inventory lists.
Has anyone tried to implement this and found a way around these
problems? I seem to remember a keyring in "Lurking Horror" by Infocom,
but it's been so long, I don't remember how it worked. I'd appreciate
Don't make it a supporter, or a container. Just make it an object. Then give
it invent and description properties that list its children. This will
need a bit of mucking about for TAKEing the keys, but not too much. And
add a new line to the UNLOCK grammar:
* noun = KeyOnRing "with" noun -> Unlock
(at the start) and a routine
[KeyOnRing; if (parent(noun) == keyring) rtrue;
Best of Luck!
- David Dyte
Of course, that's backwards.
* noun "with" noun = KeyOnRing -> Unlock
- David Dyte
>problem is, the library rules say you can't put an object on a supporter
>when you're carrying that supporter;...
So make it a container:
Object AKey "key"
with description "just a plain key",
Object ARing "key ring"
with description "a big key ring",
before [; Recieve: if (noun hasnt Key) rfalse;
move noun to self;
has container transparent;
[InRing x; !!token for telling if the object is in the keyring
if ( parent(x) == ARing ) rtrue;
Extend First 'unlock'
* noun 'with' InRing -> Unlock;
I'm not sure regaring the syntax of the grammer token/function,
you'll have to check the manual. The problem with the unlock is that
it recuires 'held' for a 'second' so you have to redefine it.
You need to add checks to see if the keyring is held and
take it if it's not but I'm not sure how to do this...
Nir Levy, The above opinions are my own,
nlevy @ usa.net not my employer's.
I didn't do it; Nobody saw me do it;
You can't prove anything; -Bart Simpson
But then, wouldn't the keys be "in the keyring" instead of "on the keyring"?
(Keys do go ON the keyrings, right?)
http://come.to/brocks.place | World Domination Through Trivia!
What games are on? Check out The Schedule!
"Lemming is the eternal force of life." --from the online weeding of Dee-Bee
And there's been another similar suggestion. This is all very well, and
helps the player keep keys together, but I'd have thought that if you've
got a number of keys on a ring you'd much prefer to unlock doors without
having to "with" anything. Any thoughts?
The "in the xxx" is printed as a library message. Use the LibraryMessages
object to change it to print "on" if xxx is the keyring, or "in" otherwise.
That what I'd do.
> But then, wouldn't the keys be "in the keyring" instead of "on the
A little work with LibraryMessages can take care of all those icky wording
problems. The ListMiscellany group.
I forget whether a container will automatically recognize "put key on
ring" (as well as "put key in ring".) But that's easy to trap too; have
the ring's before clause catch Receive, and if receive_action is PutOn,
rethrow the action with <<Insert obj self>>.
To handle "unlock door" with an implied "with" clause, do something like
Extend 'unlock' first
* noun -> UnlockAuto;
And then write an UnlockAutoSub which checks noun, checks to see if the
appropriate key is being carried. If so, print "(with ", (the) key, ")^"
and throw <<Unlock noun key>>. If not, print "None of your keys seems to
unlock that." and return true.
"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
But then the keys will be _in_ the ring, not _on_ them, which doesn't make
a whole lot of sense. An alternative suggestion might be to hack up
the LibraryMessages object so that PutOn with lm_n=4 does something more
useful, but it's probably easier just to #Replace PutOnSub and remove the
offending line of code (just search in VerbLib for the string "##PutOn,4").
+--First Church of Briantology--Order of the Holy Quaternion--+
| A mathematician is a device for turning coffee into |
| theorems. -Paul Erdos |
| David Wildstrom |
(before any grammar line for unlock)
* noun -> ImpUnlock
and of course
[ImpUnlockSub; if (noun hasnt locked) "That's not in a state to unlock.";
if (~~(noun provides with_key))
"Nothing you are carrying seems to work.";
... etc etc a loop checking things in teh player if they
are the key, eventually coming up with "The brass key works!
You unlock the door!" or the same failure message.
- David Dyte