# Extensions interoperability

Hi everybody,
I’m a novice in IF, but I’m a professional software developer.
I’m currently trying to write a short IF using a number of extensions, but in the following example I experienced some problems in interoperability.

``````"Test liquid" by The Strawberry Field

Include Metric Units (for Glulx only) by Graham Nelson.
Include Assorted Text Generation by Emily Short.
Include Measured Liquid by Emily Short.
Include Trinity Inventory by Mikael Segercrantz.

The Buffet is a room. "The buffet area for the breakfast."

A jug is a kind of fluid container. The fluid capacity of a jug is 1.5 litres.
A glass is a kind of fluid container. The fluid capacity of a glass is 200 ml.
A glass is preferred for drinking.

Table of Liquids (continued)
liquid	potable	flavor
milk	true	"Sweet."
orange juice	true	"Very refreshing."

The cupboard is a scenery supporter in the buffet.
The description is "A cupboard in light fir wood.".

Three jugs are on the cupboard.
Two glasses are on the cupboard.

Table of the jugs
liquid-type	quantity
orange juice	1200 cc
milk	800 cc
water	1400 cc

When play begins:
let tablerow be 1;
repeat with current jug running through list of jugs which are on the cupboard:
choose row tablerow in the Table of the jugs;
now the liquid of the current jug is liquid-type entry;
now the fluid content of the current jug is quantity entry;
increment tablerow.``````

The first problem (which only occurs when including ‘Metric Units’) does not even allow compilation.

Fortunately, this is easy to solve, just redefine the sentence in ‘Assorted Text Generation’ by adding ‘real’ to the parameter type:

``````To say (N - a real number) as a/-- proportion:
if N is greater than 100:
say "*** BUG: [N] being printed as a percentage ***";
repeat through the Table of Proportions:
if N is less than threshold entry:
say "[approximation entry]";
rule succeeds.``````

Running the game everything seems to work fine:

``````Buffet
The buffet area for the breakfast.

On the cupboard are a jug of orange juice, a jug of milk, a jug of water and two empty glasses.

>x orange juice
The jug is approximately three quarters full of orange juice.``````

Now I try to look at the cupboard and the result is:

``````>x cupboard
A cupboard in light fir wood.

On the cupboard are a jug, a jug, a jug and two empty glasses.``````

Last I fill a glass with the orange juice:

``````>fill glass with orange juice
(first taking the jug)
You pour orange juice into the glass.

>i
You're holding a jug of orange juice of orange juice, and you have nothing in the jug of orange juice. ``````

Excluding ‘Trinity Inventory’ the inventory works fine, but the ‘examine’ command problem seems to have no solution.

``````>i
You are carrying:
a jug of orange juice``````

Would anyone be able to give me some pointers to investigate the two problems?

First, what version of Inform are you using? The current version is 10.1.2

It seems the extensions are to blame for problems you’ve been having. This could be because they are old versions and haven’t been updated enough to keep up with Inform, or at least the version of Inform you’re using. However, this incompatibility can go both ways. It’s possible to use a too-new version of an extension if you’re using a not-current version of Inform.

Trinity Inventory may just be buggy. I don’t think it’s been heavily used or tested in the field.

Having read your post, I’m not 100% sure what problems remain. Would you be able to list them one by one?

First, what version of Inform are you using? The current version is 10.1.2

I’m using 10.1.2 August 2022

The extension are just downloaded from Friends of I7 Extensions for v10.1 so I think they are the latest available.

First problem: looking at the supporter the liquid contained in the fluid containers on the supporter are not mentioned.

Second problem, Trinity inventory related, the silly description reported in the last message.

Okay, so at the moment, the most up-to-date place to check for extensions is at the github 10.1 branch:

I know it says 10.1, but there’s some confusion about the naming of the master branch. But don’t worry about that - just check there first when looking for extensions. It also has a triage afterwards telling you about where to look for older extensions, etc.

I got Trinity, Liquid and Assorted Text… from the 10.1 page. I had to go to the Friends of I7 development branch (linked from the triage section) to get Metric Units.

I built your project. Had to make the same change as you did to Assorted Text Generation for it to compile.

I found that commenting out Trin Inventory made no difference to your problems, so that’s not it. At least yet.

I don’t know if the measured liquids extension is meant to mention the specific amount of fluid in various things in all contexts, or only when they’re directly examined? It’s a pretty detailed extension that I’ve not used before, and I haven’t tried the examples. So I actually don’t know if behaviour is missing or not in your project.

Certainly, the silly description (a jug, a jug, a jug, etc.) is some kind of bug. I wonder if Measured Liquids isn’t set up to distinguish between identically named objects in all circumstances? Note that we don’t get ‘jug, jug, jug’ in the room description version, but we do get it when examining the cupboard.

The catch may be that each item’s name is just ‘jug’. The way they are distinguished to our eyes (by their liquid contents) comes from the measured liquids extension qualities, not from the items’ printed names. Inform tends to gather things with the same printed name together unless we do things to force it not to.

If you run your project, enter the test command RULES then type LOOK, you’ll see the rule saying what’s on the cupboard is the “describe what’s on scenery supporters in room descriptions rule”. That rule (from the Standard Rules) may need some tweaking or addendums if you want the amount of liquids mentioned in that context.

The rule saying what’s on the cupboard when we X it is the “examine supporters rule”. So that rule may also need tweaks/adding to to get it to work – first, to work even as well as the “describe what’s on scenery supporters in room descriptions rule” does for your purposes, but then more so if you want liquid amounts mentioned in those contexts.

That’s what I can sus out thus far.

There’s an issue with one rule in Measured Liquids – it’s a little broad in examining the action and thinks that `examining the cupboard` should suppress the listing of contents. Try:

``````After printing the name of a fluid container (called the target) while not [examining or searching or] pouring (this is the alternate suffix with contents rule):
if the current action is the action of opening the target:
do nothing;
if the target is a liquid source:
if the target is closed and the target is not transparent:
if the person asked is not the player:
unless the target is empty:
unless examining the target or searching the target: [added]
say " of [liquid of the target]" (A);
omit contents in listing.

The alternate suffix with contents rule is listed instead of the suffix with contents rule in the after printing the name rules.
``````

EDIT: Also, Trinity Inventory is trying to replace the normal processing of articles in such a way that the `printing the name` activity is being invoked recursively. That’s why you’re getting “of water of water” – the `after printing the name` rules are running twice.

``````Rule for inventory listing the contents of a fluid container (called target):
do nothing.
``````

to prevent the spurious details about containing nothing.

EDIT 2: I looked at the structure a little more closely. This is somewhat better for preventing “of water of water” and the like:

``````Carry out taking inventory when the number of listed when carried things carried by the player is at least one (this is the alternate non-empty inventory rule):
say "holding [a list of listed when carried things carried by the player][run paragraph on]" (A).

The alternate non-empty inventory rule is listed instead of the non-empty inventory rule in the carry out taking inventory rules.

The inventory normal rule is not listed in any rulebook.
``````

Just make sure to leave out the article when setting the `inventory listing` property for an object.

1 Like

Thank you for the solution.

I found it very interesting how you can override a rule without directly modifying the original source.