[Inform] keyring?

2 views
Skip to first unread message

Michael Gentry

unread,
Feb 5, 1998, 3:00:00 AM2/5/98
to

Another question: I'm trying to implement a keyring, on which and from
which the player can put and take (respectively) several keys.

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
any suggestions.

-- M

David Dyte

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

In article <34DA92...@ey.com>, Michael Gentry <michael...@ey.com> writes:
>
> 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

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;
rfalse;
];

before that.

Best of Luck!

- David Dyte

David Dyte

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

I wrote:
>
> * noun = KeyOnRing "with" noun -> Unlock
>

Of course, that's backwards.

* noun "with" noun = KeyOnRing -> Unlock

Sorry!

- David Dyte

Nir Levy

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

In rec.arts.int-fiction, Michael Gentry <michael...@ey.com> saw fit to bestow on us:

>Another question: I'm trying to implement a keyring, on which and from
>which the player can put and take (respectively) several keys.

>..The only


>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:

Attribute Key;

Object AKey "key"
with description "just a plain key",
has Key;

Object ARing "key ring"
with description "a big key ring",
before [; Recieve: if (noun hasnt Key) rfalse;
move noun to self;
"Ok";
],
has container transparent;


[InRing x; !!token for telling if the object is in the keyring
!!or not
if ( parent(x) == ARing ) rtrue;
rfalse;
];

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...

Anyone?

/NL
--
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
--

Brock Kevin Nambo

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

Nir Levy wrote in message <34dac5da...@news.ibm.net.il>...

>In rec.arts.int-fiction, Michael Gentry <michael...@ey.com> saw fit to
bestow on us:
>>Another question: I'm trying to implement a keyring, on which and from
>>which the player can put and take (respectively) several keys.
>
>>..The only
>>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:

But then, wouldn't the keys be "in the keyring" instead of "on the keyring"?

(Keys do go ON the keyrings, right?)

>>BKNambo
--
http://come.to/brocks.place | World Domination Through Trivia!
What games are on? Check out The Schedule!
http://members.xoom.com/mozilla/monster.html
"Lemming is the eternal force of life." --from the online weeding of Dee-Bee
and Br_Lee_Luuuuuurve


Den of Iniquity

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

On 6 Feb 1998, David Dyte wrote:
>* noun "with" noun = KeyOnRing -> Unlock

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?

--
Den


Joe Mason

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

In article <uuFfF8v...@upnetnews02.moswest.msn.net>,

Brock Kevin Nambo <newsm...@earthling.net> wrote:
>>
>>So make it a container:
>
>But then, wouldn't the keys be "in the keyring" instead of "on the keyring"?
>
>(Keys do go ON the keyrings, right?)

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.

Joe

Andrew Plotkin

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

Brock Kevin Nambo (newsm...@earthling.net) wrote:
> Nir Levy wrote in message <34dac5da...@news.ibm.net.il>...
> >In rec.arts.int-fiction, Michael Gentry <michael...@ey.com> saw fit to
> bestow on us:
> >>Another question: I'm trying to implement a keyring, on which and from
> >>which the player can put and take (respectively) several keys.
> >
> >>..The only
> >>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:

That what I'd do.

> But then, wouldn't the keys be "in the keyring" instead of "on the
> keyring"?

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.

--Z

--

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."

David J Wildstrom

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

In article <34dac5da...@news.ibm.net.il>,

Nir Levy <nl...@usa.net.TO_EMAIL_REMOVE_THIS> wrote:
>In rec.arts.int-fiction, Michael Gentry <michael...@ey.com> saw fit to bestow on us:
>>Another question: I'm trying to implement a keyring, on which and from
>>which the player can put and take (respectively) several keys.
>
>>..The only
>>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:

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 |
+-------------------------------------------------------------+

David Dyte

unread,
Feb 7, 1998, 3:00:00 AM2/7/98
to

Den wrote:

(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.

Make sense?

- David Dyte

Reply all
Reply to author
Forward
0 new messages