Beginner Question: Putting a worn object into inventory?

Hi,

after about three hours of rather fruitless research (just because inventory manipulation comes up dry in the handbook or google) I hope I can find an answer here.

My character is wearing (!) a cursed item and can’t take it off. In a room there is a device which, if “switched on” should remove that item. The item should not appear anywhere else but the player’s inventory (but be “unworn” now, of course).

The farthest I got with this problem:

Instead of switching on the panic release:
if (player is wearing curseditem):
Say “You hear a soft click from the cursed item and find that you can take it off now.”;
now curseditem is on the table;

This will indeed put the cursed item on the table which, alas, is not what I want. But whenever I tried “is now not worn” “take off curseditem” “is now in inventory” … everything fails without a clue as to how it should be phrased and, as I said before, I failed to find ANY reference as to how to put things into a player’s inventory, remove items from there, make them unwear an item (except for dropping it in a location/supporter that is NOT the player or another character, say a thief) etc. Pretty frustrating … can anyone help me with this one?

“now the player carries the curseditem” is what you want.

You’re right that this is obscure – you’d expect “is not worn” to work, or “the player does not wear the ring”. The easy way to figure it out is to open up the Standard Rules and see how that does it. It’s the standard taking off rule.

(I note that most state-changing commands in Inform start with “now”. That’s a common pattern, so your guesses like “is now” were off-base to begin with.)

You can’t just negate a state, like, “now the sweater is not worn,” because Inform doesn’t know what state the sweater should be in once it’s not worn. Instead, you have to assert what new state you want the sweater to be in – “now the sweater is carried by the player,” or “now the player carries the sweater.” That’s why “now curseditem is on the table” works – you asserted specifically where you wanted the sweater to be.

You can negate some states. For example, you can say “now the chest is not open”, because open/closed is a binary property.

You might think that worn/not-worn should be a binary property – it is in I6. But I7 implements it as a relation, and a funny sort of relation at that, so this is the only way to undo it.

Ah, thanks.

I actually thought that I7 would handle it as a “property” of an item, since the location - even when worn - is “inventory”. So - since the item actually is in the inventory it did not cross my mind to put it there to make it unworn. :slight_smile:

Thanks all and back to design. :slight_smile: