Some kinds of messages are not printed directly to players; they are allowed to contain special characters marking places to include the appropriate pronoun for some player. For example, a builder might have a doorway that's very short, so that people have to crawl to get through it. When they do so, the builder wants a little message like this to be printed:
Balthazar crawls through the little doorway, bruising his knee.
The problem is the use of 'his' in the message; what if the player in question is female? The correct setting of the 'oleave' message on that doorway is as follows:
"crawls through the little doorway, bruising %p knee."
The '%p' in the message will be replaced by either 'his', 'her', or 'its', depending upon the gender of the player.
As it happens, you can also refer to elements of the command line (e.g., direct and indirect objects) the object issuing the message, and the location where this is all happening. In addition one can refer to arbitrary string properties on these objects, or get the object numbers themselves.
The complete set of substitutions is as follows:
%% => `%' (just in case you actually want to talk about percentages). Names: %n => the player %t => this object (i.e., the object issuing the message,... usually) %d => the direct object from the command line %i => the indirect object from the command line %l => the location of the player Pronouns: %s => subject pronoun: either `he', `she', or `it' %o => object pronoun: either `him', `her', or `it' %p => posessive pronoun (adj): either `his', `her', or `its' %q => posessive pronoun (noun): either `his', `hers', or `its' %r => reflexive pronoun: either `himself', `herself', or `itself' General properties: %(foo) => player.foo %[tfoo], %[dfoo], %[ifoo], %[lfoo] => this.foo, dobj.foo, iobj.foo, and player.location.foo Object numbers: %# => player's object number %[#t], %[#d], %[#i], %[#l] => object numbers for this, direct obj, indirect obj, and location.
In addition there is a set of capitalized substitutions for use at the beginning of sentences. These are, respectively,
%N, %T, %D, %I, %L for object names, %S, %O, %P, %Q, %R for pronouns, and %(Foo), %[dFoo] (== %[Dfoo] == %[DFoo]),... for general properties
Note: there is a special exception for player .name's which are assumed to already be capitalized as desired.
There may be situations where the standard algorithm, i.e., upcasing the first letter, yields something incorrect, in which case a "capitalization" for a particular string property can be specified explicitly. If your object has a ".foo" property that is like this, you need merely add a ".fooc" (in general .(propertyname+"c")) specifying the correct capitalization. This will also work for player .name's if you want to specify a capitalization that is different from your usual .name
Example: Rog makes a hand-grenade with a customizable explode message. Suppose someone sets grenade.explode_msg to:
"%N(%#) drops %t on %p foot. %T explodes. %L is engulfed in flames."
If the current location happens to be #3443 ("yduJ's Hairdressing Salon"), the resulting substitution may produce, eg.,
"Rog(#4292) drops grenade on his foot. Grenade explodes. YduJ's Hairdressing Salon is engulfed in flames."
which contains an incorrect capitalization. yduJ may remedy this by setting #3443.namec="yduJ's Hairdressing Salon".
Note for programmers: In programs, use $string_utils:pronoun_sub(). %n actually calls player:title() while %(name) refers to player.name directly.