Newsgroups: rec.arts.int-fiction
Path: news.duke.edu!newsgate.duke.edu!solaris.cc.vt.edu!news.vt.edu!netnews.com!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!world!buzzard
From: buzzard@world.std.com (Sean T Barrett)
Subject: Re: [Inform] Messages on the first turn
Message-ID: <GK0uqu.8qA@world.std.com>
Date: Fri, 21 Sep 2001 16:49:21 GMT
References: <3ba6ac6d$1@news.uow.edu.au> <3ba834b1$1@news.uow.edu.au> <qjbiqtoub4jnp6rs3j2kj00fbc3ffjimdg@4ax.com> <3baafd3f$1@news.uow.edu.au>
Organization: The World Public Access UNIX, Brookline, MA
Lines: 60
Xref: news.duke.edu rec.arts.int-fiction:92822

Kenneth Alexander Finlayson <kaf03@uow.edu.au> wrote:
>What I really want is this: some way of printing a message on the first
>turn, just after the room is described, but before the prompt appears
>(like the describe property does), but which is also printed on every
>turn, after the prompt is printed (like each_turn and daemons do).

When I wanted something to print after the room description on the
first turn only, I did it by hooking the library-message prompt-printing
code.  This is basically a total hack--see below for my preferred solution
to this problem.

You could use this to print the first time and then use an each_turn
to print all the other times.  If you want your each_turn message to
ALWAYS print last before the prompt, then you might want to just always
print it with the prompt. You need to be careful not to print it if
there's a 'meta' command, though. I wouldn't recommend this approach
because it offends my sensibilities to print game text from within
a prompt routine. (Even just doing it the first "turn" offends my
sensibilities, but I *do* do that.)

My code looks like this:

   Global first_prompt = 1;
   Object LibraryMessages with before [;
      Prompt: if (first_prompt) {
                 first_prompt = 0;
                 print "^Some message.^";
              }
   ];

You could make that print call some existing random-print routine,
or you could just hardcode the text it outputs since there's really
nothing wrong with it always printing the same "random" message on
the first turn.

What I originally did, then backed out to avoid making gratuitous changes
to the library, but which I would like to see implemented if there
is ever a 6.11 Inform library release, is to go into parserm.h
and add a call to a user-defined routine between "<Look>;" and
"while (~~deadflag)" (around line 3670 in my lightly modified lib),
e.g.

   <Look>;

   for (i=1:i<100:i++) j=random(i);

+  #ifdef BeforeFirstPrompt;
+  BeforeFirstPrompt();
+  #endif;
+
   #ifdef EnglishNaturalLanguage

While the Inform libraries are very powerful in what they do, they are
way more hard-coded and non-modular and unhookable than they should be
for a system which so many people use. (The routine being modified above
cannot be "replaced"d and even if it could be is 200 lines long.) However,
it's hard to argue that this is a *fix* to a *bug* so I haven't submitted
it to the Inform patch page.

SeanB
