[I7] Library messages
Graham Nelson
graham at gnelson.demon.co.uk
Sun Jan 20 17:29:44 CST 2008
Dear David,
> Fair enough; I can see where you are coming from.
> Users could always create their own abbreviations
> if they wanted to.
I think quite a few of the sigils are really there
because some limitation in Inform means that
you have to provide a workaround, so it may be
that by providing better facilities, we can avoid
the need. Anyway!
>> I've generalised this so that
>> the first word of any text substitution is parsed
>> case sensitively, provided the upper case form
>> has been declared.
>
> That's great; I didn't realise it did that.
It didn't, until yesterday.
> Err, a question -- in what way would you like me to be
> involved in this project? (I won't feel left out if I
> don't do anything! Just wondering ...)
Well, in fact, I am fairly notorious among the recipients
of this email for chucking out horrendous assignments
for people to take on, and as it happens I do have
some thoughts about what you might do...
The adaptation we need to make is quite a large
one since it involves changes at all levels, to
your extension, to the compiler, to the Standard
Rules, to the template files, and so on. I think
it's best to take this step-wise, even though
it means that we create intermediate versions
which will likely never see the light of day.
I propose:
1. I rewrite the Standard Rules and the template
layer so that they only produce any text under the
old I6 Library Messages system, allocating new
numbers as necessary.
2. David then makes a Windows build for you to
play with, and we give you intest and the test
suite (you particularly want Obedience, a test
case trying every action in every combination
of player and actor) so that you can verify what
you're doing.
3. You then revise Custom Library Messages
to take advantage of my changes. Ideally,
(a) your whole section 5.1 can go and you
don't need to mess with the Standard Rules
any longer, and (b) you could take advantage
of the new case sensitivity of first words of
text substitutions so as to try getting rid of
the pervasive [^...] notation.
At this point, we could in theory use the changed
setup in a public release: or we could press on.
4. The next step would involve better support by
the compiler for modifying tables, and then
we could make the decisive move away from
the old huge-switch-statement-in-I6 form of
the Library Messages altogether, and simply
use the new tables. The Standard Rules would
initially provide a big table of these messages;
this would greatly shorten your extension.
5. I think your part in that would be drawing up
the Table of Messages for the SR, and seeing
what its ideal format would be. We will clearly
need names for every message, just as you've
defined in your existing extensions. But I
really don't want to give them names in the
form:
LibMsg <functional name>
I actually quite like the angle brackets, but I
really don't like the LibMsg at all: it's just not
natural! (It's also inefficient to define hundreds
of names with the same first word, as that's the
worst-case scenario for running time of the
symbols table.) I suspect we can square this
by creating a new data type for these names,
and requiring them to be written as (say)
message <...>
message <...> of Grand Plans by Napoleon
when they occur in miscellaneous code - which
they won't, very much - but allowing them to omit
the word "message" in tables.
As for what goes in the angle brackets, hmm.
There will clearly need to be an index page
listing all of the message names known to NI.
Still, they ought to be predictable in some way.
Perhaps named after their standard text? E.g.,
message <Violence isn't the answer to this one.>
Or perhaps named after the rules which normally
issue them? Or even after actions?
message <attacking blocked>
6. You might also work further on what we need
to provide in the way of inflections. On the whole,
I like the idea of extending the use of text
substitutions like the Standard Rules's "[s]",
which is broadly what you've done in some
cases. I suspect that if I give you better facilities,
you could squeeze more out of this? For
instance, isn't this:
"[The noun] weigh[s] more than [the second noun]."
a more appealing syntax than
"[The noun] [weigh*] more than [the second noun]."
This could be accomplished by having each
printing of a name remember the GNA (gender,
number, animation), so that the definition of "[s]"
would depend on whether the last thing printed
was a name or a number, etc.
7. Then I would fix NI to understand the idea of
a language definition extension, and your
remaining stuff becomes English by David
Fisher. (See, you get to have the whole English
language named after you, so there are
compensations.) At that point we should talk
to e.g. the Spanish and French I7 people to
see what they make of the new facilities.
We will almost certainly have given them not
quite enough, but they'll be much better off
than they are now, and they deserve a
chance to look at the new deal before it's
published.
...My current state of progress with this is that I am,
in fact, still on stage (1). I have created the following
new library message numbers:
Go 7: "You'll have to say which compass direction to go in."
Inv 5: "[The actor] looks through [possessive for the actor]
possessions."
Take 16: [The actor] picks up [the noun]."
Drop 5: "There is no more room on [the x1]."
Drop 6: "There is no more room in [the x1]."
Drop 7: "[The actor] puts down [the noun]."
Eat 3: "[The actor] eats [the noun]."
Exit 5: "[The actor] gets off [the noun]."
Exit 6: "[The actor] gets out of [the noun]."
Enter 8: "[The actor] gets into [the noun]."
Enter 9: "[The actor] gets onto [the noun]."
Look 9: "[The actor] looks around."
Examine 4: "[The actor] looks closely at [the noun]."
Examine 5: "You see nothing unexpected in that direction."
LookUnder 3: "[The actor] looks under [the noun]."
Search 8: "[The actor] searches [the noun]."
Consult 2: "[The actor] looks at [the noun]."
Lock 6: "[The actor] locks [the noun]."
Unlock 5: "[The actor] unlocks [the noun]."
SwitchOn 4: "[The actor] switches [the noun] on."
SwitchOff 4: "[The actor] switches [the noun] off."
Open 6: "[The actor] opens [the noun]."
Open 7: "[The noun] opens."
Close 4: "[The actor] closes [the noun]."
Close 5: "[The actor] closes."
Wear 5: "[The actor] puts on [the noun]."
Disrobe 3: "[The actor] takes off [the noun]."
Touch 4: "[The actor] touches [the noun]."
Touch 5: "[The actor] touches you."
Touch 6: "[The actor] touches [the noun]."
Wave 3: "[The actor] waves [the noun]."
Pull 5: "[The actor] pulls [the noun]."
Push 6: "[The actor] pushes [the noun]."
Turn 7: "[The actor] turns [the noun]."
Squeeze 3: "[The actor] squeezes [the noun]."
Wait 2: "[The actor] waits."
PutOn 9: "[The actor] puts [the noun] on [the second noun]."
Insert 10: "[The actor] puts [the noun] into [the second noun]."
Give 5: "You give [the noun] to [the second noun]."
Give 6: "[The actor] gives [the noun] to you."
Give 7: "[The actor] gives [the noun] to [the second noun]."
This handles everything except the "going" report,
which as you know is pretty multifarious. (I quote
the source text below.) It can make dozens of
variations, I imagine, and took just ages to get
right. It needs to be split up as
If condition 1 then complete message 1
else if condition 2 then complete message 2
else if condition 3 then complete message 3
...
else complete message N
but what should N be, and how would you split
this so that translators and users could tinker
with the result? I'd be glad of any advice you have.
Best,
Graham
Report an actor going (this is the describe room gone into rule):
if the player is the actor
begin;
produce a room description with going spacing conventions;
otherwise;
say "[The actor]";
if the noun is a direction
begin;
if the location is the room gone from, say " goes ";
otherwise say " arrives";
let the back way be the opposite of the noun;
if the location is the room gone to
begin;
let the room back the other way be the room back way from the
location;
let the room normally this way be the room noun from the
room gone from;
if the room back the other way is the room gone from or
the room back the other way is the room normally this way
begin;
say " from [if the back way is up]above[otherwise if the
back way is down]below[otherwise]the [back way]";
end if;
otherwise;
if the location is the room gone from
begin;
say "[if the noun is up]up[otherwise if the
noun is down]down[otherwise][noun]";
otherwise;
say " at [the room gone to] from [if the back way is
up]above[otherwise if the back way is
down]below[otherwise]the [back way]";
end if;
end if;
otherwise;
say "[if the location is the room gone from] goes through
[otherwise] arrives from [end if][the noun]";
end if;
if the vehicle gone by is not nothing
begin;
if the vehicle gone by is a supporter, say " on ";
otherwise say " in ";
say "[the vehicle gone by]";
end if;
if the thing gone with is not nothing
begin;
say ", pushing [the thing gone with]";
if the player is within the thing gone with
begin;
say " in front, and you along too";
otherwise if the player is within the vehicle gone by;
say " in front";
otherwise if the location is the room gone from;
say " away";
otherwise;
say " in";
end if;
end if;
if the player is within the vehicle gone by and the player is not
within the thing gone with
begin;
say ", taking you along.";
try looking;
continue the action;
end if;
say ".";
end if.
--
Graham Nelson
More information about the Inform7-porters
mailing list