Measured Liquids 1: 5Z71? 6E59?

I’m trying to use Emily Short’s Measured Liquids extension. My code is a fairly simple version of the “Lakeshore” example she included, like so:

Include Measured Liquid by Emily Short.

The Attic is a room. 

On the table is a fluid container called the carafe.  The fluid capacity of the carafe is 10.0 fl oz.  The description of the carafe is "Shiny."

The rain is a liquid stream in the Attic.

Under 5Z71, the compiler complained that “The sentence ‘The liquid-mixing rules are a volume based rulebook producing a liquid’ appears to say two things are the same - I am reading ‘liquid-mixing rules’ and ‘volume based rulebook producing a liquid’ as two different things, and therefore it makes no sense to say that one is the other[…]”

I took this to mean that maybe Measured Liquid had already been updated for 6E59 (as Em’s blog post does imply) with some sort of fancy kinds-usin’ that allowed phrases like “volume based rulebook producing a liquid” – I admit I haven’t really examined 6E59 yet – so I downloaded 6E59 and tried again. It compiled fine, but the game opens up with the less-than-charming proclamation that “[** Programming error: tried to read from -->18804 in the array “multiple_object”, which has entries 0 up to 159 **]” (four times in a row).

So, which version of the compiler is Measured Liquid 1 intended for? What am I doing wrong? I am willing to just make my liquids from scratch if necessary, but I’d been hoping to avoid coding the pouring/filling/etc syntax.

Edit: I’m on OSX if it makes any difference.

Measured Liquids is definitely intended for 6E59, and won’t run under anything previous.

Testing at home: it looks like this problem arises when compiling the z-machine and not under Glulx. It also is something that wasn’t arising during earlier phases of testing the extension, but the final set of double-testing I did on the extension examples I did once, under Glulx settings. So something appears to have arisen late in the process that messes up this extension for Z-machine.

One solution would be to post it as “for Glulx only”, but I’d rather not do that. I’ll try to see what could be going wrong that would be z-specific, and post a followup.

Okay. Having now stripped this down to essentials, it appears to be a compiler bug rather than a Measured Liquids bug (and the very strangest compiler bug I have ever seen, because it comes and goes in response to source spacing, among other things).

I’m going to post the compiler bug; then I’ll try to see whether I can make the extension not do this in spite of the bug. If I get a solution, I’ll send it to be posted. If you want to do something about it before then, either

a) compile to Glulx, if you don’t mind having that as your target (easy)
b) if you don’t feel you’re likely to need mixable liquids that are finicky as to the component quantities in a liquid, open up the extension, find “recipe quantities”, and bracket out as follows:

[code][The liquid-mixing rulebook has a list of volumes called the recipe quantities. ]

First liquid-mixing rule for a volume (called the poured volume) (this is the assign quantities while mixing rule):
now the destination container is the second noun;
add the liquid of the noun to the recipe contents;
add the liquid of the second noun to the recipe contents;
sort the recipe contents;
[repeat with item running through the recipe contents:
if the item is the liquid of the noun:
add the poured volume to the recipe quantities;
otherwise:
add the fluid content of the second noun to the recipe quantities. ][/code]

(For the technically curious: the problem seems to be specifically to do with having a rulebook that has two list variables associated with it; getting rid of one of the lists also does away with the problem.)

At the risk of spamming the thread: I have now sent in version 2 of this extension; it will likely appear on the site soon. V2 is just very slightly less capable than version 1, but the functionality removed is likely to be valuable only under rare circumstances, and then can still safely be achieved by compiling to Glulx. In exchange, it appears to reliably compile for Z-machine without programming errors.

Please let me know if you need an email copy of the extension before it goes live on the website, or if you successfully download but still have trouble with it.

Ah, I was thinking something like that would work, but I caught some flak last time I did so. :stuck_out_tongue:

I definitely don’t need mixable liquids – the only in-game liquid is water – so this should be fine.

Thanks so much for your speedy and thorough response!

Well, if you want, you could replace the section of Measured Liquid that deals with this, which is to say, Chapter 3 - Basic Mixtures. You’d copy the extension section into your own code, make the modifications suggested (or just slice out the commented bits entirely), and then head your code section with something like

Chapter X - Less Buggy Mixtures (in place of Chapter 3 - Basic Mixtures in Measured Liquid by Emily Short)

This is the Officially Approved way of making such changes. But I promise not to be offended if you feel like doing it the faster way.