change (being worn)

I’m trying to simplify clothing layering by specifying clothes as innerwear and outerwear. When inner wear is worn and the player puts on outerwear, a relation kicks in and the inner wear is taken off-stage.

However, when taking inventory, I want to reference the offstage but presumably hidden garment by mentioning the outerwear and then the inner wear it covers.

After printing the name of a garment (called layer) while taking inventory: if layer covers something (called underlayer): say " (worn over [underlayer])".

I get

i
You are carrying:
a red dress shirt (worn over teeshirt) (being worn)

I would like to suppress (being worn) in this case hopefully without a huge mess of tearing out rules. Anyone?

Have you looked at examples 177 and 414? Unfortunately they make it seem pretty complicated.

I thought I had solved it just as I posted, but now I’m causing Glulxe fatal error: Stack overflow in function call by doing this:

Rule for printing the name of a garment (called layer) while taking inventory: if layer covers something (called underlayer): say "[the layer] (worn over [the underlayer])"; otherwise: say "[the layer] (being worn)".

Yeah. I looked at those and they seem useful but nothing clear jumped out.

It looks like the thing you need to mess with is “giving inventory information”.

I excerpted the inventory action from standard rules, took out that part, and got this:

Instead of taking inventory: issue library message taking inventory action number 2; say ":[line break]"; list the contents of the player, with newlines, indented, including contents, with extra indentation.

The other thing this phrase fiddles with is the container appendage (so claims the documentation, although my empty test bottle didn’t give a status in inventory either way, only when in a room description). So you might need to re-add that if you want it, or at least keep an eye out for it.

Edit: there are other ways to eliminate the (empty), so maybe there’s a way to eliminate (being worn) without that.

I think you’re causing an infinite loop – each “[the layer]” calls the rule for printing the name of the layer again. Try replacing those with “[the printed name of the layer]” and see what happens. (Though I suspect you’ll get the “(being worn)” anyway.)

So far, this is the version that doesn’t crash glulxe…I just fiddled with the phrasing, and I think I can live with this:

After printing the name of a garment (called layer) while taking inventory: if layer covers something (called underlayer): say " (over [a underlayer])".

i
You are carrying:
a leather loincloth
some blue jeans
a red dress shirt (over a teeshirt) (being worn)

Even better, fewer parenthsesesesses:

i
You are carrying:
a red dress shirt over a teeshirt (being worn)
some blue jeans over a glittery gstring (being worn)
some tennis shoes over some wool socks (being worn)

take off shirt
(the red dress shirt)
You take off the red dress shirt.

Dropped.

i
You are carrying:
a teeshirt (being worn)
some blue jeans over a glittery gstring (being worn)
some tennis shoes over some wool socks (being worn)

Now if I can just figure out how to use that “group a kind as a sentence while taking inventory”…

I was remiss not to point to a couple of extensions about putting inventory in a single sentence, both of which handle worn stuff without the parentheses. I’ve never used either of them but they might be worth a look.

Oooh, I loved TRINITY.