Substitution

From TinyMUX
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

The most basic form of evaluation is a %-substitution. Even when other forms of evalution are not performed, %-substitutions usually are. A %-substitution is a '%' followed by one or two letters, digits, or symbols.

If a sequence is understood, it is substituted by a corresponding value.

If a sequence is not understood, the initial '%' is removed. In this way, the '%' also acts similarly to the '\' escape.

For some substitutions, if the letter following the '%' is capitalized, the first letter of the result of the substitution is also capitalized.

Certain %-sequences provide gender-specific pronouns. Some provide information about the execution state. Some provide control over the appearance of text.

Commonly-Used

%r
Carriage Return
%t
Tab
%b
Space
%%
Literal '%'.
%\
Literal '\'.
%x<code>
ANSI color codes.
%c<code>
ANSI color codes.

Pronoun-Related

%s, %S
Subjective form: he, she, it, they. See: subj(%#)
%o, %O
Objective form: him, her, it, them. See: obj(%#)
%p, %P
Possessive form: his, her, its, their. See: poss(%#)
%a, %A
Absolute Possessive form: his, hers, its, theirs. See: aposs(%#)

Database

%n, %N
Enactor's name. See name(%#).
%va-%vz
Contents of attribute va through vz.
%=<attr>
Equivalent to v(attr) or get(me/attr).

Execution State

%m
Text of the last command executed.
%0-%9
Value of positional parameter/stack location 0 through 9.
%q0-%q9
Value of temporary (setq) register 0 through 9.
%qa-%qz
Value of temporary (setq) register A through Z.
%#
Database number of the object that caused the message to be displayed or the action list to be run (Enactor).
%@
Database number of the object immediately calling %! (Caller). This number starts as the same as %#, but can be affected by u()-type functions, zones, and @function.
%!
Database number of the object holding the message or running the action list (Executor).
%l
Database number of the location of the object that caused the message to be displayed or the action list to be run.
%|
A string piped from the previous command in a pipe.

Note that %<whatever> is equivalent to v(<whatever>), but is more efficient.

See also: ANSI(), ANSI codes, ANSI substitution, Gender, V().

Relevant help files: help substitutions, help substitutions2, help substitutions3