Re: My Inform box won't work!


7 Aug 95 22:02:05

jools@arnod.demon.co.uk (Julian Arnold) wrote:

> Well that's fine, but my next problem is that I print up my little quote in
> its box, only to have the top scroll off the top of the screen before I read
> it because of the '>' prompt. I'm calling the `Quotations' routine after
> I've printed everything else on the screen, but can't really make it appear
> after the prompt. Is there, then, any way to explicitly tell the game where
> on the screen to draw a `box'?

[ Note that I haven't really used Inform very much, so I wouldn't be
surprised if someone pointed out a better way of doing this. ]

I don't think there is any such feature built into the `box', and the
compiler doesn't seem to allow you to redefine the Box__Routine function
which (I think) is inserted automagically in the code if you compile a
program which uses the `box' feature. (A bit of a pity the function isn't
in the library instead, but I guess there is a reason for that.)

So short of writing your own code for creating boxes, I guess you're out
of luck. If, however, the problem is simply that the game prints text
between the time you call `box' and the prompt is written, you could, if
you are using release 5/8 or later of the library, insert something like
this between the inclusion of "Parser" and the inclusion of "VerbLib":

Global box_message = 0;

Object LibraryMessages "lm"
with before
[; Prompt:
! Note that it's up to each object that sets 'box_message' to
! make sure that it is only done once per game (if that is the
! desired behaviour).
!
! The idea of catching the "Prompt" message for this purpose
! was, unless memory fails me, suggested by Graham some time
! back. I take no credit for it.
switch (box_message) { ! Or 'if'-statements in Inform 5.4
0: rfalse; ! This is, of course, the usual case
1: box "A computer, to print out a fact,"
"Will divide, multiply, and subtract."
" But this output can be"
" No more than debris,"
"If the input was short of exact."
""
"-- Gigo"; ! Whoever that is
2: box "A man said to the Universe: ~Sir, I exist!~"
""
"~However,~ replied the Universe, ~the fact has"
"not created in me a sense of obligation.~"
""
"-- Stephen Crane";
! etc. etc.
}

box_message = 0; ! Always clear the variable afterwards
rfalse;
];

If the box still scrolls off, I guess you could try adding the line

print "^>";

first in the "Prompt" clause, and change rfalse to rtrue, which should
cause the box to be printed one line lower, but it shouldn't, really,
be necessary to use this kind of tricks, should it?

Torbj|rn Andersson