Abbreviations in Glulx vs ZMachine

I’ve been experimenting with converting my game to Glulx, and found an unexpected behavior compared to Zmachine.

I generate abbreviations using zabbrev and include them in my source file. On Zmachine, this works great.

On Glulx, abbreviations with newlines get printed as caret-symbols, not newlines.

Here’s a simplified case showing the behavior:

!%+.,inform6lib
!% -e

Abbreviate ". ^^";                          !    99x 7, saved   486

Include "Parser";

Object Dorter "Dorter"                                                   ! >Dorter
  has light
  with
    description [;
      ! On first turn of game, don't overwhelm player with room description
      if (before_first_turn) {
        "^There are several of your fellow monks here---Brothers Benedict, Hugh
        and Anselm---along with your mentor, Brother Aelred.";
      }

      "This great room is used by all of the choir monks except the prior,
      Brother Oswald. It could easily provide rest for twenty brothers, but
      there are only eight cots in here now. Each cot has a chest at its foot
      for any meagre possessions the brother has.

      ^^A window high up reflects light on the floor.

      ^^A doorway leads south to the Hall. Narrow stairs descend to the Quire,
      where offices are held.";
    ];

[ Initialise;
    location = Dorter;
];

Include "VerbLib";
Include "Grammar";

On ZMachine, the LOOK command shows this:

Dorter
This great room is used by all of the choir monks except the prior, Brother Oswald. It
could easily provide rest for twenty brothers, but there are only eight cots in here now.
Each cot has a chest at its foot for any meagre possessions the brother has.

A window high up reflects sunlight on the floor.

A doorway leads south to the Hall. Narrow stairs descend to the Quire, where offices are
held.

on Glulx, it shows this:

Dorter
This great room is used by all of the choir monks except the prior, Brother Oswald. It
could easily provide rest for twenty brothers, but there are only eight cots in here now.
Each cot has a chest at its foot for any meagre possessions the brother has. ^^A window
high up reflects light on the floor. ^^A doorway leads south to the Hall. Narrow stairs
descend to the Quire, where offices are held.

Of course, after I make my abbreviations, I can remove any with “^” in them, but is there a better fix? Is this a bug?

I know practically nothing about Glulx text encoding, but do it even make use of abbreviations?

I know that it uses some Huffman character encoding so zabbrev (made for z-machine) won’t calculate abbreviations especially well anyway.

How do ^ print in Glulx when not abbreviated?

How are other special characters handled when they are abbreviated (~ for ", for example)?

1 Like

Abbreviations work — the text replacements come out. And “^” is the same in Glulx, as far as I can tell: it causes a newline in running text.

I added an abbreviation containing “~”, and that comes out literally as a tilde, not as a quote mark.

It’s quite likely that it’s not very important to have abbreviations with Glulx, since memory isn’t limited in the ways it is in the ZMachine. But it’d be a nasty trap for someone who uses abbreviations from ZMachine (perhaps, like me, converting code from ZMachine): everything works, they generate abbreviations another time, and this time, they get an abbreviation that breaks things)

1 Like

This is a bug in Inform6, which has been around for ages: https://github.com/DavidKinder/Inform6/issues/123

2 Likes

Thanks, @DavidK .

Found the missing code and made a PR to fix it. Thanks for pointing me to the issue.

2 Likes

It’s quite likely that it’s not very important to have abbreviations with Glulx

Right. This is a code path that I suspect very few people have exercised, which is why the bug sat around so long. But it is a bug.

Thanks for the PR – I will look at it tonight.

2 Likes