Substitutions
Substitutions
Section titled “Substitutions”The % symbol is used in MUSH commands to indicate a substitution — some other character(s) or words are substituted for whatever follows the % symbol. Some common substitutions are:
%b = a single space (just like `[space(1)]`)<br> %r = a blank line<br> %t = A tab. Note that this may not look right on some screens.<br> %# = dbref of the ENACTOR (object that set off the command)<br> %n = the ENACTOR's name<br> %N = the ENACTOR's name, first letter capitalized<br> %~ = the ENACTOR's accented name, like accname(%#)<br> %: = the ENACTOR's unique identifier, like objid(%#)<br> %k = the ENACTOR's name, colored by `@moniker`, like moniker(%#)<br> %% = a literal %Case makes a difference in all substitutions; capitalizing the first letter after the % will capitalize the first letter of the resulting substitution.
Pronouns
Section titled “Pronouns”If the ENACTOR’s gender is set, you can use these substitutions to get the
right pronoun for him/her:
%s = subjective pronoun: he, she, it, they. Same as subj(%#)
%o = objective pronoun: him, her, it, them. Same as obj(%#)
%p = possessive pronoun: his, her, its, their. Same as poss(%#).
%a = absolute possessive: his, hers, its, theirs. Same as aposs(%#).
Case makes a difference: %S will return He, She, It, They.Some attributes can be retrieved via substitutions:
%va-%vz = the contents of the object’s VA-VZ attributes, respectively
%wa-%wz, %xa-%xz = as above, for WA-WZ and XA-XZ
These are the equivilent of get(me/<attribute>).
Substitution reference
Section titled “Substitution reference”Other substitutions:
%0-%9 = the contents of the REGISTERS 0-9, respectively
%@ = the caller’s dbref number. Initially same as %#, changes when something like ufun() is called.
%! = the dbref number of the object the command is on (the EXECUTOR)
%L = the dbref of the ENACTOR’s location
%d = the DESCRIPTOR (port) the command was entered from
%c = text of the last command, before evaluation
%u = text of the last command, after evaluation, available to locks/hooks
%> = the output of the last command, like a function’s result: see command output
%| = what the command before a ;| showed you: see piping
%? = The current function invocation and depth counts
%= = The dbref/attribute currently being evaluated, or #LAMBDA/<code> inside a #lambda
%+ = The number of arguments passed to the current ufun.
%qN = the equivalent of r(N) for registers 0-9 and A-Z set by the setq() function
%q\<N\> = the equivalent of r(N) for a named register set by the setq() function
%iN = equivalent of itext(N), the list element for iter()/@dolist.
%$N = equivalent of stext(N), the <string> in switch()/@switch.
::: seealso
- evaluation order
- [%#]
- [%!]
- database
- registers
- V() :::
Substitution examples
Section titled “Substitution examples”Example:
> @sex me=male > @drop box=%n just dropped %p box. > drop box Cyclonus just dropped his box.Let’s say that Cyclonus’s dbref number is #10 and the box’s dbref number is #11. The dbref of the room Cyclonus is standing in is #13. When Cyclonus dropped the box above, these were the values of the following %-subs:
%n = Cyclonus %# = #10 %@ = #10 %! = #11 %L = #13