Re: [inform] two possible things


06 Dec 1995 18:46:22 GMT

Tim Middleton <ab651@freenet.durham.org> wrote:
> The first is i need terribly to change the bracketed message given
> after the name of a room is printed if you are on a supporter or in a
> container, such as might be:
>
> Aquarium Room (in the fish tank)
>
> I might (though this merely a hypothetical example) NEED to change it
> to something like:
>
> Aquarium Room (swimming with all the little fishies)

Tricky. The following horrible hack springs to mind:

Object LibraryMessages "lm"
with before [;
Look:
if (lm_n == 2 && player in FishTank) {
print "swimming with all the little";
give FishTank general;
rtrue;
}
];

Object FishTank "fish tank"
with short_name [;
if (self has general) {
give self ~general;
print "fishies";
}
else print "fish tank";
rtrue;
];

That is, the LibraryMessages object notices when the offending string is
about to be printed, and sets a flag on the FishTank object instructing
it not to print its name as usual. Note also that the message is
distributed between the two objects because `LookSub' prints a space
after the first bit and before the second.

What a ghastly hack! You're almost better off changing `LookSub' in
`verblib.h'...

> You know how when it lists all the items in the area that are "visible",
> and quite logically says:
>
> You can see the toaster oven and a roll of duct tape.
>
> Well (again just a hypothetical, only vaguely related to what i'm *really*
> trying to do <hehe>-- but still an interesting idea, now that i think of
> it!) what if the person was blind and you wanted to print:
>
> You can feel the toaster oven and a roll of duct tape.

This is easy to change; try something like

Object LibraryMessages "lm"
with before [;
Look:
if (lm_n == 5 or 6) {
if (x1~=location)
{ if (lm_o has supporter) print "^On "; else print "^In ";
DefArt(lm_o); print " you";
}
else print "^You";
print " can "; if (n==5) print "also "; print "feel ";
WriteListFrom(child(lm_o),
ENGLISH_BIT + WORKFLAG_BIT + RECURSE_BIT
+ PARTINV_BIT + TERSE_BIT + CONCEAL_BIT);
if (lm_o~=location) ".";
" here.";
}
];

Most of the code is copied from towards the end of verblib.h, with
"see " replaced by "feel ". Again, the upward compatibility of this
approach is low, so you may want to edit verblib.h.

[Note for Inform hackers: the difficulty of maintaining a variant copy
of the library is somewhat exaggerated; with modern interactive 3-way
difference tools like `ediff' it is possible with less than 5 minutes'
work for each new version of the library.]

-- 
Gareth Rees