Resetting the recognized direct/indirect object

First, thanks for reading this!

Ok, I’m not even sure if what I want to do here is possible, but here it goes.

For immersion purposes, I want to make it known to the player of my game that he has a magical “carry all” called “a pack” with unlimited carrying capacity.

However, I also don’t want the player to ever need to mess with it. No opening or closing or putting things in it or taking things out or dropping it by accident or any of that. It’s there. It holds everything. But don’t worry about it.

I know that I can create the pack, give it to the player and then say “Instead of doing anything to the pack, say such and such…”

But that (as far as I can tell) only covers when the pack is the direct object (examine pack) and not the indirect object (put socks in pack).

If there’s a simple way around that, I couldn’t see it. So I did the following:

After reading a command when the command prompt is ">":
	if the player's command includes "pack":
		say "Your pack is a magical carry-all with an almost unlimited capacity for small and medium-sized items. Your character makes use of it without being instructed to do so.";
		reject the player's command;

That’s pretty elegant and I like it, except that it allows for this to happen:

>x key
You see nothing special about the blue key.

>x pack
Your pack is a magical carry-all with an almost unlimited capacity for small and medium-sized items. Your character makes use of it without being instructed to do so.

>drop it
Dropped

Of course the “it” is referencing the key, not the pack. But that’s not how it looks to the player. It looks like he’s dropping the pack. I would prefer the same response that you get when inform recognizes no direct object, such as what happens when you say “x it” at the start of the game:

>x key
You see nothing special about the blue key.

>x pack
Your pack is a magical carry-all with an almost unlimited capacity for small and medium-sized items. Your character makes use of it without being instructed to do so.

>drop it
I'm not sure what 'it' refers to.

Is there a way that I can “clear” the last referenced object that Inform has stored to allow the above to happen?

1 Like

I think this should work:

After reading a command when the command prompt is ">":
	if the player's command includes "pack":
		set pronouns from the pack;
		say "Your pack is a magical carry-all with an almost unlimited capacity for small and medium-sized items. Your character makes use of it without being instructed to do so." instead.
1 Like

You can do Before doing anything when the noun is the pack or the second noun is the pack to cover all cases.

2 Likes

That did it! That allows me to do what I originally intended in the first place. Thank you so much!

1 Like

Thanks! Juhana’s solution allowed me to set it up the way I originally wanted, but this info is also really good to know because I wasn’t sure how to manipulate Inform’s use of pronouns and now I do, which will come in handy later. Thanks again!

2 Likes