PunyInform quote box workaround?

Hi, I am quite new at using PunyInform. I have started using quote boxes and noticed a difference between z3 and z5/z8 behaviour, probably because z3 doesn’t contain “real” quote boxes.

Ironically, when I compile to z3 I get the behaviour I want but not with z5 and z8. The problem is, that I want to display some text followed by a quote box. When I run the z3-file, the quote appears beneath the text, so the player can read the text. But when I run the z5- and z8-version, the screen is cleared before the quote box is printed and so the player will never see the text printed before the quote.

If there is some kind of PunyInform command, which pauses the game while waiting for a key press, that would solve it, e.g. something like: WaitForKeyPress();

Quite releated, is there also a PunyInform command to clear the screen?
Thanks!

1 Like

I’ve ran into the same problem you are facing now while developing Hibernated 2. To make a long story short: I ended up NOT using Puny’s Quotebox feature. Instead a I draw a quote box with characters, so I am basically emulating the behavior of the Z3 version of Puny’s Quotebox extension. The downside is that it won’t look as fancy on Z5 or Z8 but since the majority of my target audience is playing the game on retro platforms, hence will be using Z3, I thought that’s fine. Also saved me quite some bytes because there was no need to import the extension itself. This is what I wanted to achieve and how it looks like.

And this is how it ended up in my code.

Actually doesn’t look too bad. Here is an example taken from the Atari ST target, where z5 is used.

2 Likes

Thanks, sounds like a good solution. And as you say, we save a bit of memory too :slight_smile:

I suppose that it isn’t possible to have a WaitForKeyStroke(); or something like that with PunyInform yet, as you probably would have applied it then?

It must be possible to implement a “wait for key stroke”-command in PunyInform, at least for z3, as it already happens when you display a quote in z3. I actually added a single line quote “Press Enter/Return” in places where I wanted the player to hit a key before continuing until I realized that I couldn’t do the same with z5 and z8. I guess there will always be users who wants improvements :wink:

If you want to wait for the user pressing any key, you can do that in z5 (but not in z3), like this:

[ KeyCharPrimitive key;
@read_char 1 -> key;
return key;
];

In z5, clearing the lower window can be done with:

@erase_window 0;

z3 provides a lot less control over the screen as well as input and output. With PunyInform we have aimed to make everything work both in z3 and z5, but sometimes they can’t work exactly the same. We’ll have another look at the quote box extension and see if it can be improved though.

Good luck with your project!

2 Likes

Great - thanks - and in z3-games, I can just make a one-line quote “Press Enter/Return” so all versions should be covered :slight_smile:

I suppose another possibility would be to use the primitive v3 screen-splitting. Though whether or not it looks any good is debatable:

puny-quote

My Inform 6 is pretty rusty, but this is the quick-and-dirty prototype code I used:

Array DarknessQuote table
    "------------------------------"
    "Light thinks it travels faster"
    "than anything but it is wrong."
    "No matter how fast light"
    "light travels, it finds the"
    "darkness has always got there"
    "first, and is waiting for it."
    "            -- Terry Pratchett"
    "------------------------------";

Global CloseQuoteBoxIn = 0;

[ PunyQuote t i lines;
    ! This function should check if screen-splitting is available. There is a
    ! header bit for that.
    lines = t-->0;
    @split_window lines;
    @set_window 1;
    for (i = 1 : i <= t-->0 : i++) {
        spaces 5;
        print (string) t-->i, "^";
    }
    @set_window 0;
    CloseQuoteBoxIn = 1;
];

[ ClosePunyQuote;
    if (CloseQuoteBoxIn > 0) {
        CloseQuoteBoxIn--;
        if (CloseQuoteBoxIn == 0) {
            @split_window 0;
        }
    }
];

And then I redefined AfterPrompt() to call ClosePunyQuote().

Edit: Oops, I made a typo in the quote. Oh well, I don’t care. :sunglasses:

3 Likes

Thanks for the info. Screen splitting could be nice in some situations. I am completely new to Inform 6, but I managed to copy your code into the right places of my game, or at least it doesn’t give any errors.

But I wasn’t able to locate AfterPrompt() so I could not redefine it as you described.

Still, it seemed to work, though Lectrote and Frotz did not fully agree on how to behave when I was playing the z5-file. Also, Lectrote did not behave exactly the same each time I restarted the game but it might if I do it correctly?

I simply display a quote like this: PunyQuote(quote_1);

In the version of PunyInform I downloaded (1.7), AfterPrompt() is called by parser.h, and is “defined” as a stub in puny.h. So at least if I define it myself before including the PunyInform library, it should use that definition. I think. As I said, rusty…

I wasn’t able to put all of the quote closing code there, because I used a global variable and if I declared that before including PunyInform, the status line would print the wrong thing. (Actually, I don’t even know if I need that global variable or not, I just wanted to make sure that the screen stayed split for a move for my proof-of-concept.)

I only tested the code - briefly - as a z3 game in Frotz. It wasn’t intended for v5 at all, where I thought there already was a working quote box? (Which also uses @split_window, but there it can do a much better job of it.)

1 Like

I am learning a lot here, so thanks. I will use z3 for 8-bit machines and z5 for 16-bit and better I think. Now that I know how to pause a z3, a z5 and a z8 game by waiting for a key stroke, I think I will stick to PunyInform’s quote box for quotes. Still, split screen could be handy as a status panel or something.

After z3, it’s mainly used for the status line. I guess the most elaborate thing Infocom used it for was the forms and computer in Bureaucracy.

The only z3 game I’ve heard of that uses it is Seastalker, for the sonarscope display. If your interpreter didn’t support it (e.g. the original Macintosh interpreter), you had to manually examine the sonarscope every so often. Which was tedious.

1 Like

Well, Infocom also used split screen for quote boxes and for hint menus. You can’t position the cursor in the lower window, so a typical menu system where you can move up and down has to be in the upper window.

1 Like

That’s why I said “mainly” :grinning:

By the way, since z4/z5 allows you to position the cursor I assume it’s mandatory that the upper window uses a fixed-width font? But in Seastalker it seems the game explicitly has to ask for a fixed-width font for the sonar display, so there it’s up to the interpreter to decide?

In z6, it once again seems to be ok to use proportional fonts everywhere (?), but I’m not overly familiar with the z6 screen model. I do know that the graphical Infocom games have a lot of platform-specific checks, and that things still sometimes had to be tweaked when they were released for a new platform.

That’s why there may be glitches if the interpreter doesn’t match the platform the game was written for. (Or if you start playing the game with an interpreter pretending to be for one platform, and then load that savegame into an interpreter pretending to be another.) And some of those platform checks are a bit… unexpected. There are some Frotz bug reports about that now, actually.

(Though the most horrible platform-specific thing I’ve come across so far is Bureacracy, which uses a busy-wait loop for delays and hard-codes how many thousand iterations it needs for a one-second delay on each platform…)

Yes.

Good question. If you look at screenshots of Infocom’s v3 interpreter for Macintosh, you’ll see that it uses Chicago font for the status line. Not a fixed-width font! So explicitly switching to fixed-width for the sonarscope makes sense.

2 Likes