I hope someone can help me out here. I would like to be able to print the definite article of an object as part of a SAY statement, without also printing the name of the object.
I have defined a ‘shortname’ for objects which can be used to describe them in certain circumstances:
[code]The warehouse is a room. “Dusty and dim.”;
an object has some text called shortname. the shortname of an object is usually “[printed name]”.
a big brown cardboard box is in the warehouse. the shortname of the cardboard box is “cardboard box”.
check entering the cardboard box:
say “You’re too big to get inside [the shortname of the box].”[/code]
This would print: “You’re too big to get inside cardboard box.”
If I was using:
say "You're too big to get inside [the box]."
then this would work. How do I emulate it in my code?
You can define your own say phrases for this purpose:
[code]
To say the shortname of (item - object): say “the [shortname of item]”.
To say a shortname of (item - object):
let txt be indexed text;
let txt be the shortname of item;
if character number 1 in txt matches the regular expression “”, say "an ";
otherwise say "a ";
say shortname of item.
[/code](Note that the last phrase will go wrong in cases like “an hourglass” and “a Union Jack”. It just checks whether the first letter is a vowel or not.)