Inventory listing

Hello, i just upgraded to the new version of inform and now the ‘trinity inventory’ of M. segercrantz is not working anymore. I tried to adapt it, but i could not see how, it has some complex errors i am not able to interpret and rewrite.
Basically all i want is a routine which goes through all carried things, and prints not the name, but a variable called ‘the inventory listing’, so the inventory looks like the one in Infocoms trinity. sounds simple; tried a few approaches; but it seems my break from programming has been to long, so i gave up for the time being.

Now a question: does anybody have an idea how to achieve this seemingly simple goal? I googled here, and there were a few suggestions for alternates to taking inventory but nothing did really work for me. please advise!

thank you and l,g stefan

I don’t remember what it is about Trinity that you’re trying to emulate, but it sounds like you want this:

A thing has a text called the inventory listing.

Rule for printing the name of something (called T) when taking inventory and the inventory listing of T is not empty:
	say the inventory listing of T.

The player carries a rock.
The player carries a sword.
The inventory listing of the sword is "ancient Elvish sword".

Do you mean you want your inventory to look like this?

If so, try something like this (in addition to Zarf’s code).

Carry out taking inventory (this is the new inventory rule):
    if the player carries something:
        say "You're carrying [a list of things carried by the player]";
    otherwise:
        say "You aren't carrying anything";
    say ", and you're ";
    if the player wears something:
        say "wearing [a list of things worn by the player]";
    otherwise:
        say "not wearing anything[if the player is not carrying anything] either[end if]";
    say "."

Thank you! I knew it was not complicated but i had trouble finding the exakt wording. the three lines produce sg. like:

You’re carrying an a wornout rope (with both ends free), and you’re wearing a the rucksack you have found near the hidden herbal garden and a woodsman outfit. In the the rucksack you have found near the hidden herbal garden are an a precious looking box, made of some shimmering metal with inlaid jewels and an a skillfully crafted wooden bottle.

the only thing left to do would be the handling of articles… i did sg. like that, but years ago, maybe even in I6. if you have a few lines at hand for me i would be very grateful, because i might need hours to find the correct wording for this again.

lg, stefan

thank you for your answer, draconis, i tried a variant of your suggestion before but it did not what i wished it to do. In the game Trinity, the wording for the Inventory was not like a list of objects, but sg. similar to what you can see in my last post. I like this way of doing inventory, because it has a more literature like feeling to me.

Inform chooses articles based on which ones you use in your source. So “[a random thing carried by the player]” will use the indefinite article, and “[the random thing…]” will use the definite. The same holds for lists (“a list of…” vs “the list of…”).

That’s not the problem. You can use the inventory listing for more than inventory, so the article for the object should be in the text. If you use the standard inventory rule as in the example about you will get e.g. double articles and additionally it is not possible to use text like “some supposedly very potent red liquid”. It is sometimes practical to have two different standard ways of referring to an object.

If you’re putting the article in the text you can just say [random thing…] or [list of…] to leave it off.

I have (I believe) updated Mikael Segercrantz’s Trinity Inventory to work with 6L02. There wasn’t any deep change required; in a couple places “change… to” had to be changed to “now… is” and there were some rules of the form “A carry out taking inventory rule when…” which apparently had to be changed to “Carry out taking inventory when…” I changed the example too and tried to go through and make everything adaptive and tagged for responses though I may not have entirely succeeded there. It’s attached for your perusal – if anyone is in touch with Mikael hopefully this meets his approval.
Trinity Inventory.txt (20.5 KB)