[I6] Which interpreters support DM4 Ex 134 (registering mouse clicks)?

I wanted to try to complete this exercise, and the interpreters I’ve tried so far will run the game file but don’t seem to register mouse activity (even for the provided example solution’s code). Note that this exercise requires compiling to Z-machine version 6.

Are there any modern (or even old) interpreters that can support checking mouse activity for Z6?

You should upload your story file for testing.
I can tell you that I’ve used mouse input in Zork Zero and Journey in the following (in addition to Infocom’s interpreters running in DOSBox): Xfrotz, Grotz, Zoom, and SDL Frotz. I remember that old DOS Frotz also worked circa 2004.

@Nathan, sure. This is just the example solution as provided by the DM4, not my code.

Switches v6;

! EXERCISE 134 (provided example solution, DM4 pp. 513-514) 
! Write a test program to wait for mouse clicks and then print out the state of the mouse.
! (Requires Z6)

Array mouse_array --> 4;

[ Main k;
    @mouse_window 0;
    for (::) {
        @read_char 1 -> k;
        @read_mouse mouse_array;
        switch(k) {
            253, 254:
                if (k == 253) print "Double-";
                print "Click at (", mouse_array-->0, ",",
                    mouse_array-->1, ") buttons ",
                    mouse_array-->2, "^";

V6 mouse clicks are implemented in Windows Frotz. (You can tell by clicking on the compass rose in Zork Zero.)

It works in SDL Frotz, printing the coordinates. The number after “buttons” is always 1.

@DavidK, I picked up a fresh copy at http://www.ifarchive.org/if-archive/infocom/interpreters/frotz/WindowsFrotz.zip and tried it out. Works like a charm, and comes with a great diagnostic test example “game”, too. Thank you, both for the response and for the work of making WinFrotz! I was pleased that it also respected the optional “prompt” parameter to suppress filename dialogs for the @save and @restore opcodes used in Exercise 137, too. (The provided example solution for Ex 135 about menus did not work, but I note that your diagnostic example doesn’t make use of @make_menu, so I’m guessing that they’re just not supported. If that’s not the case, please let me know, and I’ll test some more.)

@Nathan, thanks also for this. The b should be 1 to reflect the click that caused the printout, so it sounds like it’s working. I’ve been using the outdated Frotz 2.44 from the Ubuntu repositories, which doesn’t include any mouse support, but I see that there are instructions on how to build SDL Frotz at SDL Frotz now fully integrated with Unix Frotz which hopefully are still good, so maybe I’ll try that later.

Building sfrotz is the same except you go to gitlab.com rather than github.com. Or you can use a tarball from the IF Archive.

@otistdog Good to hear Windows Frotz worked for you.

Windows Frotz does implement @make_menu, at least enough for the (very limited) use of it made by the Mac release of Journey, although to get anything to happen with menus with that game you need the version of Journey released for the Mac, and to set the interpreter number to Macintosh. I’ll try to look at DM example 135 when I can.

How was that used? I don’t remember seeing any extra menu when I played the game on a Mac back in the day.

By the way, shouldn’t it be possible to get curses frotz to support mouse clicks as well, if it doesn’t already? I vaguely remember experimenting with that long ago, but I guess I must have thrown out those files at some point.

There is just an extra “Journey” menu added, with a few, not very interesting, options:

Hmm… I don’t get that extra menu when I run the game in a Macintosh emulator. Maybe Infocom never actually implemented it themselves? There does seem to have been plans for Journey that never actually came to fruition. Not just that it’s billed at the first game of a trilogy, but the back of the box claims the game has “theme music”. And the screenshots are clearly from an earlier build: The font is different, and the villain of the game is still referred to as “the Evil One”.

Mind you, I think it’s pretty cool to see pre-release material. I wish there was a better scan of this image from Journey that wasn’t in the final game, because I remember how fascinated I was by it when I first saw it. But if there is, I’ve never seen it:


@make_menu seems to work for me:

Switches v6;

Replace KeyboardPrimitive;

Include "Parser";
Include "VerbLib";

Zcharacter terminating 252;

Array mouse_array --> 4;

[ KeyboardPrimitive b p k s i;
  b->1 = 0; p->1 = 0;
  @aread b p -> k;
  if (k ~= 252) return;
  @read_mouse mouse_array;
  s = Do_M-->(1 + mouse_array->7);
  for (i=1: i<=s->0: i++) { b->(i+1) = s->i; print (char) s->i; }
  new_line; b->1=s->0; @tokenise b p;

Array D1 string "Do";
Array D2 string "look";
Array D3 string "wait";
Array D4 string "inventory";
Array Do_M table D1 D2 D3 D4;

[ Initialise;
  @mouse_window 0;
  @make_menu 3 Do_M ?Able;
  "*** Unable to generate menu. ***";

Include "Grammar";


That’s interesting: I’ve always assumed that menus were observed on the Mac releases, but having never had a Mac, I’ve never been in a position to test it.

@DavidK, how foolish of me! Never having seen the menu system in use, I was looking for a text-driven menu within the main screen, not on the menu bar of the application itself. (… and that’s yet another note added to my heavily marked-up DM4.)

WinFrotz is working fine – best of class, in my experience. Thanks again for making it!

I can’t pick two posts to be solutions, but FYI for future searchers: Both WinFrotz (thanks, DavidK) and SDL Frotz (thanks, Nathan) handle this.

Thanks to @eriktorbjorn the next frotz release will have mouse support for the curses interface, enabled with the -m command line switch.