User Tools

Site Tools


mud:substitutions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mud:substitutions [2019/08/08 15:01] (current)
admin created
Line 1: Line 1:
 +The most basic form of evaluation is a %-substitution. ​ Even when other forms of evaluation 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:​
 +<​code>​
 +    %r       ​Carriage Return
 +    %t       Tab
 +    %b       Space
 +    %%       ​Literal '​%'​.
 +    %\       ​Literal '​\'​.
 +    %x<​code>​ ANSI color codes. See: ansi().
 +    %c<​code>​ ANSI color codes. See: ansi().
 +</​code>​
 +
 +Pronoun-related substitutions:​
 +<​code>​
 +    %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(%#)
 +</​code>​
 +Database substitutions:​
 +<​code>​
 +    %n, %N   ​Enactor'​s name.  See name(%#).
 +    %k, %K   ​Enactor'​s moniker. ​ See moniker(%#​).
 +    %va-%vz ​ Contents of attribute va through vz
 +    %=<​attr>​ Equivalent to v(attr).
 +</​code>​
 +Execution state substitutions:​
 +<​code>​
 +    %m       Text of the last command executed.
 +    %0-%9    Value of positional parameter/​stack location 0 through 9.
 +    %i0-%i9 ​ Equivalent to itext(0) through itext(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.
 +</​code>​
 +
 +Note that %va-%vz is equivalent to [get(%!/​a)]-[get(%!/​z)],​ and %=<​name>​ is equivalent to [get(%!/​name)]. ​ The substitutions forms are more efficient.
 +
 +Note that %=<​name>​ supports single-letter attributes names while [v(name)] does not. For attribute names longer than one character, %=<​name>,​ [get(%!/​name)],​ and v(name) are equivalent.
 +  ​
 +Related Topics: [[mud:​ANSI()]],​ [[mud:ANSI CODES]], [[mud:ANSI SUBSTITUTION]],​ [[mud:​GENDER]],​ [[mud:​V()]].
  
mud/substitutions.txt ยท Last modified: 2019/08/08 15:01 by admin