Request help with forcing a player to keep an item in I7

Hi.

I’m very new to all of this and i’ve got the Inform 7 thingy with the two books in it, and i had a local printer give me a super nice paper version of this handbook by Jim Aikin but I need help.

I want to make an inventory item that once picked up, two things happen:
1: it’s impossible to remove this from the inventory, through dropping or putting it on or putting it in stuff, or giving it or throwing it or whatever… it has to become bound to character.
2: it is no longer in the spot where the player picked it up.

Thank you for your assistance.

You’ll have to write a rule that takes all possibilities of discarding the item into account and override them.

Dropping the ring is discarding the ring.
Putting the ring on something is discarding the ring.
Inserting the ring into something is discarding the ring.

Instead of discarding the ring:
	say "But it's your precious!"

I think those three actions cover all the ways you can get rid of inventory items in the Standard Library. You’ll still have to be mindful of it when writing your own actions or rules.

It’s a good idea to add a small rule that checks if the item has left the inventory, to catch any cases you might have missed:

Last every turn when the ring is handled and the player is not carrying the ring:
	say "*** Programming error: the ring has left the inventory ***"

Another way is to make the item a part of the player. That way it should certainly be impossible to discard it.

After taking self-confidence:
	now self-confidence is part of the player;
	continue the action.

The downside is that it won’t show up in the inventory listing.

Requirement 2 is never a problem because a thing can never be in two places at the same time. (Unless it’s a backdrop, but backdrops aren’t portable and even they are moved around internally to give an appearance of being simultaneously in multiple rooms.)

I don’t see a poll option that would suit my needs; I would like to select “Good question, in the right part of the forum, and clearly explained, but the poll wasn’t really necessary.” :wink:

Juhana, thanks! :slight_smile:
Peter Piers, yes there is, check again!

You are right, how could I have missed it? Must have been my in-built modesty; seeing my name made me blush and wave that option away. You telepath, you.

One tip: I don’t know what your item is, but if it’s being worn, the player needs to take it off before they can do anything else with it. Blocking that action prevents the player from doing anything to get rid of it.

It’s a gun. :slight_smile: