From OtherSpace: Encyclopedia Galactica
Revision as of 10:49, 8 August 2011 by ShanG (Talk | contribs) (Created page with '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 substitu…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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))
%R = a blank line
%T = A tab. Note that this may not look right on some screens.
%# = dbref of the ENACTOR (object that set off the command)
%N = the ENACTOR's name, first letter capitalized
%n = the ENACTOR's name, first letter as-is
%~ = the ENACTOR's accented name
%: = the ENACTOR's unique identifier, like objid(%#)

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
%o = objective pronoun: him, her, it, them
%p = possessive pronoun: his, her, its, their
%a = absolute possessive: his, hers, its, theirs.

Case makes a difference: %S will return He, She, It, They. If you need an actual % symbol, use %% or \% to get it.

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

Other substitutions:

%0-%9 = the contents of the REGISTERS 0-9, respectively
%@ = the caller's dbref number. Initially same as %#, changes when something like a U-FUNCTION is called.
%! = the dbref number of the object the command is on.
%L = the dbref of the ENACTOR's location.
%c = text of the last command, _before_ evaluation.
%u = text of the last $command, after evaluation, available to locks.
%? = The current function invocation and depth counts.
%+ = The number of arguments passed to the current ufun.
%qN = the equivalent of r(N), a register set by a setq() function.

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 %-variables:

%N = Cyclonus
%# = #10
%@ = #10
%! = #11
%L = #13

See also: EVALUATION, ENACTOR, EXECUTOR, DBREFS, v()