New "Default Messages" extension

Though I don’t envy whoever might take up David Fisher’s offer (plea?) to take over maintenance on his extension Default Messages, I wrote a new Default Messages extension to hopefully ease the burden on his popular one. Mine isn’t at all compatible with David’s, but rather, starts afresh, and utilizes Inform features that didn’t exist when David started his well over two years ago. It’s smaller and more lenient on memory. The Z-machine would like it.

The largest difference between the two extensions is that mine doesn’t attempt to name every one of the 300+ messages in the library. I had found when writing Grouped Messages As Dialogue that all those names tend to cause annoying name clashes. (And slowing down compilation speed too, I believe.) And, the documentation is short. That’s always a win.

Opinions and such would be appreciated. It is found here (though with a curiously incorrect blurb).

This looks potentially useful. I did encounter a problem with the second example, though, but I think it may be a problem with Inform rather than with your code.

When I click the paste button for the second example, the statement:

To say miscellaneous library message (N - a number):  (- L__M(##Miscellany,{N}); -).

Is posted into the code window as:

To say miscellaneous library message (N - a number): (--)   L__M(##Miscellany,{N}); -) .

This, of course, won’t compile since the spurious extra -) immediately after the opening (- causes the rest of the I6 inclusion to not be recognized as such.

You might want to look into this out to check whether my analysis is correct here and if so submit a bug report.

– Eric

Looks very cool, Ron! I particularly like your discovery mechanism. That should be very useful.

This looks very nice and lightweight. I’d wondered if those stub phrases in the Standard Rules were actually connected to the template layer, and now I know!

One thing that I think is missing from the extension is a hook before and after message-printing. For example, if said hooks were provided with an activity, an author could write:

[code]Before printing a miscellaneous message:
say “[italic type][run paragraph on]”;

After printing a miscellaneous message:
say “[roman type]”;[/code]

A number of folks are interested in styling error messages differently, printing them in a separate window, etc.; this kind of before/after hook would allow that.

I like your library message alerts, including the idea that an author could quickly scan transcripts returned by testers to look for the curly-braced alerts that indicate a message that is still the default. In that vein, it might also be nice to allow the library message alerts to print to the transcript only–that is, not appear in-game, but only in the transcript. That way, an author could see the alerts in transcripts returned by testers without subjecting them to curly braces and number signs. In Glulx, this can be done like so:

[code]To say transcript only:
(- if (gg_scriptstr) { glk_stream_set_current( glk_window_get_echo_stream(gg_mainwin) ); } -)

To say standard output:
(- glk_set_window(gg_mainwin); -)

…say “[transcript only]Message[standard output]”.[/code]

I’m not sure how you’d do it in z-code, but I assume that it’s possible.


@Eric Eve

Thanks, Eric. It means a lot to me that a veteran author finds a place for it in his toolbox.

I’ll report the bug, and see if I can arrange things to avoid the bug in the first place.


Thank you. I intend to add one more example to the extension which lists the whole table, fully re-written in Inform 7, so an author would be able to simply search the example rather than hunting around in the first place.

@Erik Temple

I had considered those hooks, but the After hook in particular was neither simple nor elegant. Besides, most of the time the extension would only be used for its main job, and I didn’t want to complicate matters. (I almost had the thing consult a table that varies, but I figured the one or two authors that wanted that could alter the extension themselves.)

I’m looking into doing David’s other extension Custom Library Messages similarly, and for that I will use an activity. (Plus, if one is committed to changing all messages, the pre-existing ones can be removed with a single line of code, gaining back a cool 10K of Z-machine memory.)

Thanks, Ron. I especially appreciate that if you were originally using David Fisher’s extension, it takes very little rewriting replace it with yours. I just slotted it into my WIP and it works perfectly.

Version 2 is now up, and I consider the thing done. This is what changed:

  • It is now compatible with builds 6E72, 6E59, 5Z71, 5U92, and 5T18. This was accomplished mainly by changing “action name” to “action-name”. Some of the examples might be a bit fussy on older builds, but the core functionality works perfectly. For the oldest two builds, rename the extension from “Default Messages.i7x” to just “Default Messages” before installing.

  • A new section heading was added to keep the index clean.

  • If the Use Option isn’t used, it will not be compiled into either build. Formerly it was in the debug build whether it was used or not.

  • The odds & ends example was expanded, showing how to re-implement a few of the trickier messages in the game, including the error message, “I don’t know the word ‘[misunderstood word]’.”

  • A new example, “The Complete Table” shows an I7 implementation of every single library message. It can be used for reference or for pasting directly into your WIP.

Eric: I couldn’t find a workaround for that paste bug, so I removed the paste icons and will report the bug today.

Mike: Thank you Mike!