SUBSTITUTIONS

From TinyMUX

Jump to: navigation, search

Contents

SUBSTITUTIONS

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 substitutions

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

Pronoun-related substitutions

 %s, %S 
Subjective form: he, she, it, they. See: [[subj()}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 substitutions

 %n, %N 
Enactor's name. See name(%#).
 %va-%vz 
Contents of attribute va through vz

Execution state substitutions

 %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.

Related Topics: ANSI(), ANSI CODES, ANSI SUBSTITUTION, GENDER, V().

Personal tools