Help Entries starting with 'R'
@readcache
This wizard-only command reads special text files into a cache and rebuilds the help and news indices. This must be done every time the text files (connect text, help files, etc.) are changed while the game is running. It does not need to be used after changing the names.cnf file of bad player names.
A site admin can achieve the same effect by sending the MUSH process a kill -1 or kill -HUP.
@receive
- @receive <recipient>[=<message>]
- @oreceive <recipient>[=<message>]
- @areceive <recipient>[=<message>]
@receive sets the message that is shown to the recipient who acquires an object by 'get'ing it or having it 'give'n to them. @oreceive is a message shown to others in the recipient's location, and @areceive is an action run by the recipient. If not set, the recipient gets a default message ("Jane gave you A Headache").
%0 will be set to the dbref of the object received. %1 will be set to the dbref of the giver if a 'give' was performed.
@rejectmotd
This is a wizard only command that will set a short (non-longterm) message that will be shown to players that try to connect when logins are disabled. This is the "Down MOTD" in the @listmotd listing. The siteadmin can set a more permanent message for this by editing the file "down.txt".
@remit
- @remit[/switches] <object>=<message>.
Sends the message to all contents of <object>, which can be a room, thing, or player. The message is also sent to the <object> itself. (The TinyMUSH equivalent is @pemit/contents).
The /silent switch stops the remitter from getting feedback if they're
in a different location than the target.
The /noisy switch always gives feedback to the remitter if they are
not in the target location. Without /silent or /noisy, the silent_pemit
config option is used to determine noisiness.
The /list switch will send the message to the contents of multiple
objects at the same time. The <OBJECT> argument is treated as a
space-separated list of targets.
The /spoof switch causes nospoof notifications to show the enactor's
dbref instead of the executor's dbref, and requires control over
the enactor or the Can_nspemit power.
@restart
- @restart <object>or@restart/all
This command halts <object> (as described in @halt), and then triggers the STARTUP attribute on the object, if set. If <object> is a player, it affects the player and all of their objects. Players can use @restart me to restart their own objects. The /all switch halts all objects (see @allhalt) and restarts them, and can only be used by a wizard.
@runout
- @runout <object>=<actionlist>
Sets the actions to be taken when the charges of the object reaches zero.
@rwall
Only wizards and royalty may use this command. It broadcasts a message to all connected wizards and royals. If the /emit switch is given, it's done as a prefixed emit. Otherwise, it acts like a @channel.
R()
The r() function is used to access "local registers", and returns the contents of the specified register. There are 36 such registers, numbered 0 through 9, and A through Z.
The '%qN' percent-substitution can also be used to access these local registers, where N is register <register> needed.
See 'HELP SETQ()' for details about registers.
RAND()
- rand(<num>)
- rand(<min>, <max>)
Return a random number.
The first form returns an integer between 0 and <num>-1, inclusive. The second returns an integer between <min> and <max>, inclusive.
If called with an invalid argument, rand() returns an error message beginning with #-1.
RANDWORD()
- randword(<list>[,<delim>])
Returns a randomly selected element from <list>. <delim> is the list delimiter: if not specified, whitespace delimits the list.
pickrand() may be an alias for randword() on some servers.
RECV()
- recv(<player|descriptor>)
Returns the number of characters received by a player during this connection as indicated by SESSION.
The caller can use the function on himself, but using on any other player requires privileged power such as Wizard, Royalty or SEE_ALL.
REGEDIT()
- regedit(<string>, <regexp>, <replacement>[, ... , <regexpN>, <replaceN>])
- regediti(<string>, <regexp>, <replacement>[, ... , <regexpN>, <replaceN>])
- regeditall(<string>, <regexp>, <replacement>[, ... , <regexpN>, <replaceN>])
- regeditalli(<string>, <regexp>, <replacement>[, ... , <regexpN>, <replaceN>])
These functions are a version of edit() that uses regular expressions. The part of <string> that matches the <regexp> is replaced by the evaluated <replacement>, with $<number> in <replacement> expanded to the corresponding matching sub-expression of <regexp>, with $0 the entire matched section. If you use named sub-expressions (?P<foo>subexpr), they are referred with with $<foo> (Note that the <>'s are literal).
regedit() only replaces the first match. regeditall() replaces all matches. The versions ending in i are case insensitive. The <replacement> argument is evaluated once for each match, allowing for more complex transformations than is possible with straight replacement.
Example:
> say regedit(this test is the best string, (?P<char>.)est, $<char>rash)
You say "this trash is the best string"
> say regeditall(this test is the best string, (.)est, [capstr($1)]rash)
You say "this Trash is the Brash string"
REGEXP
(This help text is largely from TinyMUSH 2.2.4, with permission)
The majority of matching in MUSH is done with wildcard ("globbing") patterns. There is a second type of matching, using regular expressions, that is available in certain circumstances.
For attributes that are $-commands or ^-listen-patterns, setting that attribute "regexp" (with '@set <object>/<attribute>=regexp') causes patterns to be matched using regular expressions rather than globbing. In addition, the function regmatch() performs regular expression matching.
In a regular expression match, the substring of the string which matched the regexp pattern is %0; %1 through %9 are the substrings of the string which matched parenthesized expressions within the regexp pattern.
Continued in 'help regexps2'.
REGEXP CLASSES
In a character class, you can use a number of additional keywords that match certain types of characters. The keywords are enclosed in [: and :], within the character class, so the whole thing looks like [[:NAME:]].
These keywords can be mixed with other things in the character class, like [ab[:digit:]], which will match 'a, 'b', or a digit. [:^NAME:] reverses the meaning of NAME - it expands to everything but characters that would match [:NAME:].
Some recognized NAMEs:
digit, for numbers. [[:digit:]] is the same as \d.
[[:^digit:]] is the same as \D.
alpha, for letters.
alnum, for numbers and letters.
lower, for lower-case letters.
upper, for upper-case letters.
word, for word characters. [[:word:]] is the same as \w.
[[:^word:]] is the same as \W.
space, for whitespace characters. [[:space:]] is the same as \s.
[[:^space:]] is the same as \S.
Continued in 'help regexp classes2'
REGEXP CLASSES2
These keywords (Or the corresponding \codes) should be used instead of explicit ranges where possible to improve portability. For example, [A-Za-z] and [[:alpha:]] are not the same thing in languages with accented characters.
Example:
> say regmatch(foo_bar, lit(^[[:word:]]+$))
You say "1"
> say regmatch(foo bar, lit(^[[:word:]]+$))
You say "0"
Other, less useful, character class keywords include ascii, cntrl, graph, print, punct, and xdigit.
REGEXP EXAMPLES
Topic: REGEXP EXAMPLES
The regexp pattern '.' is equivalent to the wildcard '?'; it matches one and only one of an arbitrary character.
The regexp pattern '.+' is equivalent to the wildcard '*'; it matches one or more arbitrary characters. To match zero or more arbitrary characters, the regexp pattern is '.*'.
To match a string of numbers, use: [0-9]+ or \d+
To match a string of letters only, use: [A-Za-z]+ or \w+
See 'help regexp syntax' for a more detailed explanation.
REGEXP SYNTAX
PennMUSH uses PCRE for its regular expression engine. PCRE is an
open source library of functions to support regular expressions whose
syntax and semantics are as close as possible to those of the Perl
5 language. The text below is excerpted from its man page. PCRE
was written by Philip Hazel <ph10@cam.ac.uk>, and is Copyright (c)
1997-1999 University of Cambridge, England. You can find it at
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
(Note that in PennMUSH, if the regular expression is in an eval'd context (like an argument to regmatch), you'll have to do a lot of escaping to make things work right. One way to escape an argument like %0 is: regeditall(%0,\\W,\\$0) or similar).
Regular expression matching in PennMUSH can be used on user-defined command or listen patterns. In this usage, regular expressions are matched case-insensitively unless the attribute has the CASE flag set. Regular expressions can also be matched in MUSHcode using regmatch(), regrab(), regedit, etc. function families, which usually come in case-sensitive and case-insensitive versions. (Cont'd in help regexp syntax2)
regexp syntax2
A regular expression is a pattern that is matched against a subject string from left to right. Most characters stand for themselves in a pattern, and match the corresponding characters in the subject.
There are two different sets of meta-characters: those that are recognized anywhere in the pattern except within square brackets, and those that are recognized in square brackets. Outside square brackets, the meta-characters are as follows:
\ general escape character with several uses
^ assert start of subject
$ assert end of subject
. match any character except newline
[ start character class definition
| start of alternative branch ("or")
( start subpattern
) end subpattern
? 0 or 1 quantifier (after a unit to quantify)
or, minimal match (after a quantifier)
or, extends the meaning of ( after a (
* 0 or more quantifier
+ 1 or more quantifier
(Cont'd in help regexp syntax3)
regexp syntax3
Part of a pattern that is in square brackets is called a "character class". It matches any character listed in the class. In a character class, the only metacharacters are:
\ general escape character
^ negate the class, if the first character in the class
- indicates character range (e.g. A-Z, 0-4)
[:NAME:] A symbol for a group of characters that can vary
according to the language the mush is using.
See 'help regexp classes' for more information.
] terminates the character class
A backslash will escape most metacharacters, and can turn some normal characters into generic character types:
\d any decimal digit
\D any character that is not a decimal digit
\s any whitespace character
\S any character that is not a whitespace character
\w any "word" character (letter, digit, or underscore)
\W any "non-word" character
(Cont'd in help regexp syntax4)
regexp syntax4
A backlash can also be used for two useful assertions -- conditions that must be met at a particular point in a match:
\b word boundary
\B not a word boundary
A word boundary is a position in the subject string where the current character and the previous character do not both match \w or \W (i.e. one matches \w and the other matches \W), or the start or end of the string if the first or last character matches \w, respectively.
(Cont'd in help regexp syntax5)
regexp syntax5
Quantifiers specify repetition of characters. Three are available:
* match 0 or more of whatever came before
+ match 1 or more of whatever came before
? match 0 or 1 of whatever came before
(In theory, you can match m-n of whatever came before with {m,n}, but the MUSH parser makes it difficult to use {}'s in functions unless you store the regex pattern in an attribute and use v() to fetch it)
Quantifiers are usually greedy -- they match as much as possible. Adding a ? after a quantifier causes it to match as little as possible instead.
(Cont'd in help regexp syntax6)
regexp syntax6
Outside a character class, a backslash followed by a digit greater than 0 (and possibly further digits) is a back reference to a capturing subpattern earlier (i.e. to its left) in the pattern, provided there have been that many previous capturing left parentheses. A back reference matches whatever actually matched the capturing subpattern in the current subject string, rather than anything matching the subpattern itself. So the pattern
(sens|respons)e and \1ibility
matches "sense and sensibility" and "response and responsibility", but not "sense and responsibility".
You can give names to subpatterns and refer to them that way instead of using numbers.
(?P<NAME>subexpr) (Note: Literal <>'s) is a named capture, and
(?P=NAME) refers back to it. The above pattern might be written:
(?P<word>sens|respons)e and (?P=word)ibility
(Cont'd in help regexp syntax7)
regexp syntax7
An assertion is a test on the characters following or preceding the current matching point that does not actually consume any characters. There are two kinds: those that look ahead of the current position in the subject string, and those that look behind it.
An assertion subpattern is matched in the normal way, except that it does not cause the current matching position to be changed. Lookahead assertions start with (?= for positive assertions and (?! for negative assertions. For example, Lookbehind assertions start with (?<= for positive assertions and (?<! for negative assertions.
Assertion subpatterns are not capturing subpatterns, and may not be repeated, because it makes no sense to assert the same thing several times. If an assertion contains capturing subpatterns within it, these are always counted for the purposes of numbering the capturing subpatterns in the whole pattern.
(Cont'd in help regexp syntax8)
regexp syntax8
PCRE's engine can also do conditional subpattern matching, embedded comments in regexps, and a bunch of other things. See a regexp book for details.
REGEXPS2
Regular expressions are extremely useful when you want to enforce a data type. For example, if you have a command where you want a player to enter a string and a number ('+setnum <player>=<number>', for example), you might do it like this:
&DO_NUM Command Object=$^\+setnum (.+)=([0-9]+)$: @va me=Data: %1 = %2 @set Command Object/DO_NUM = regexp
Then, '+setnum cookies=30' would set VA to "Data: cookies = 30". This eliminates your having to check to see if the player entered a number, since the regular expression matches only numbers. Furthermore, the '+' guarantees that there needs to be at least one character there, so a player can't enter '+setnum cookies=' or '+setnum =10' or similarly malformed input.
The '+' sign in the command has to be escaped out, or it is taken as a regexp token. Furthermore, the pattern-match has to be anchored with ^ and $, or something like 'try +setnum cookies=30 now' would also match.
Regular expression syntax is explained in 'help regexp syntax'.
REGISTERS
A register is essentially a little reserved piece of computer memory that can hold some variable information that you want to pass on to another command. There are ten registers on the MUSH available via %-substitution (%0 - %9) and thirty-six setq registers available via %q- substitution (%q0 - %q9 and %qA - %qZ).
The basic registers are filled with information that matches the wildcard pattern of the command trigger. (Before you say "Huh?", here's an example.)
&COMMAND me=$command *+*:@emit %0 is in register 0 and %1 is in register 1. > command whee+blert foo whee is in register 0 and blert foo is in register 1.
(continued in help registers2)
REGISTERS2
As you can see from the above example, the command trigger had two wildcards separated by a "+" sign. When the user types in the command with some words taking the place of the wildcards, the first register (register 0) is filled with whatever part of the command replaces the first wildcard (in this case, "whee") and the second register is filled with whatever replaces the second ("blert foo").
They can also be filled with information that is passed by an @trigger command:
&SOMECODE me=@emit %0 is in register 0 and %1 is in register 1. @trigger me/somecode=whee,foo bar > whee is in register 0 and foo bar is in register 1.
The registers can also be accessed using the V-function (v(0) through v(9)).
Please see 'help setq()' for more information about the setq registers.
REGMATCH()
(Help text from TinyMUSH 2.2.4, with permission) regmatch(<string>, <regexp>[, <register list>]) regmatchi(<string>, <regexp>[, <register list>])
This function matches the regular expression <regexp> against the entirety of <string>, returning 1 if it matches and 0 if it does not. regmatchi() does the same thing, but case-insensitively.
If <register list> is specified, there is a side-effect: any parenthesized substrings within the regular expression will be set into the specified local registers. The syntax for this is X:Y, where X is the number (0 is the entire matched text) or name of the substring, and Y is the q-register to save it in. If X: isn't given, the nth substring based on the register's position in the list minus one is used. The first element will have the complete matched text, the second the first substring, and so on. This is to maintain compatibility with old code; it's recommended for new uses that the X:Y syntax be used.
For example, in regmatch( cookies=30 , (.+)=(\[0-9\]*) ) (note use of escaping for MUSH parser), then the 0th substring matched is 'cookies=30', the 1st substring is 'cookies', and the 2nd substring is '30'. If <register list> is '0:0 1:3 2:5', then %q0 will become "cookies=30", %q3 will become "cookies", and %q5 will become "30". If <register list> was '0:0 2:5', then the "cookies" substring would simply be discarded.
See 'help regexp syntax' for an explanation of regular expressions.
Regular expression functions
These functions take a regular expression (regexp, or re) and match it against assorted things.
regedit() regeditall() regeditalli() regediti() regmatch()
regmatchi() regrab() regraball() regraballi() regrabi()
regrep() regrepi() reswitch() reswitchall() reswitchalli()
reswitchi()
REMIT()
- remit(<object>, <message>)
- nsremit(<object>, <message>)
Sends a message to the contents of <object>, as per @remit.
nsremit() is a wizard-only variation that works like @nsremit.
REMOVE()
- remove(<list>, <word>[,<delimiter>])
Remove takes a list and a word, and returns the list, with the first occurrence of the word deleted from it.
A word is defined as a string which contains no interior spaces (or <delimiter>'s if <delimiter> is used). If the word is not in the list, then the list is returned. It is case-sensitive.
To remove all occurrences of a word from a string, consider using edit().
REPEAT()
- repeat(<string>, <number>)
This function simply repeats <string>, <number> times. No spaces are inserted between each repetition.
Example:
> say [repeat(Test, 5)]
You say, "TestTestTestTestTest"
REPLACE()
- replace(<list>, <position>, <new item>[,<single-character separator>])
This replaces the item at <position> of <list> with <new item>. If no separator is given, a space is assumed. Null items are counted when determining position, as in 'items()'.
Example:
> say [replace(Turn north at the junction,2,south)]
You say, "Turn south at the junction"
> say [replace(blue|red|green|yellow,3,white,|)]
You say, "blue|red|white|yellow"
REST()
- rest(<list>[,<delimiter>])
Returns a list minus its first element.
RESTARTS()
Returns the number of times the server has been rebooted with @shutdown/reboot since the last full startup.
RESTARTTIME()
Returns a string which is the time the MUSH last rebooted. The time is in the same format as the TIME() function returns.
RESTRICT
Commands and functions can have their permission levels controlled in the mush config files, or by wizards from the game via @command and @function.
In the config file, the syntax is: restrict_command command-name restriction [" <error message>] restrict_function function-name restriction
From the game: @command/restrict command-name=restriction [" <error message>] @function/restrict function-name=restriction
For commands, if <error message> is given, that message is sent to the player who runs it instead of a generic, unhelpful error message.
(Continued in restrict2)
RESTRICT2
<restriction> can be one of the following:
god Command or function is usuable only by God.
wizard Usable only by wizards.
admin Usable only by Wiz/Roy.
nogagged Usable only by non-GAGGED objects.
nofixed Usable only by non-FIXED objects.
noguest Usable only by non-guest @powered objects.
nobody Nothing can use it. Same as the /disable switch
to @command or @function.
noparse Function arguments are not evaluated. Only applies
to @functions.
localize %q-registers are saved/restored when evaluating, as if
the @function were wrapped in localize().
userfn Function can only be called from within an @function.
Commands can also use the 'noplayer' restriction, which stops player objects from using the command, as well as any generic <flag> or any <power>.
(Continued in restrict3)
RESTRICT3
In cases where there are a function and command that do the same thing (Like pemit() and @pemit), the command's restrictions are also checked when the function is called, so restricting @pemit also restricts pemit(). However, a function's restrictions are not checked when a command is called, to allow disabling side-effect functions.
Some functions (Like name()) have non-side-effect and side-effect versions depending on how many arguments they're called with. The side-effect version can be disabled while keeping the safe non-side-effect form with the 'nosidefx' restriction. This can also be used to disable pure side-effect functions.
RESWITCH()
- reswitch(<string>, <re1>, <list1>[, ... , <reN>, <listN>] [, <default>])
- reswitchall(<string>, <re1>, <list1>[, ... , <reN>, <listN>] [, <default>])
- reswitchi(<string>, <re1>, <list1>[, ... , <reN>, <listN>] [, <default>])
- reswitchalli(<string>, <re1>, <list1>[, ... , <reN>, <listN>] [, <default>])
These functions are just like switch() except they compare <string> against a series of regular expressions, not wildcard patterns. reswitch() is case-sensitive, reswitchi() is case-insensitive. The reswitchall versions evaluate every corresponding <list>, not just the first that matches a regexp.
REVWORDS()
- revwords(<list of words>[,<delimiter>[, <output separator>]])
This function reverses the order of words in a list.
Example:
> say revwords(foo bar baz eep)
You say, "eep baz bar foo"
RIGHT()
- right(<string>, <length>)
Returns the <length> rightmost characters from string.
RJUST()
- rjust(<string>, <length>[,<fill>])
This function pads a string with leading characters ("right-justifies") so it is <length> long. If <string> is longer than <length>, the <string> is returned; it is not truncated. If <fill> is not specified, a space is used.
Examples:
Example:
> say -[rjust(foo,6)]-
You say, "- foo-"
Example:
> say %r0[rjust(foo,6,-)]%r01234567
You say, "
0---foo7
01234567"
RLOC()
rloc(<object>, <levels>)
This function may be used to the get the location of an object's location (and on through the levels of locations), substituting for repeated nested loc() calls. <levels> indicates the number of loc()-equivalent calls to make; i.e., loc(loc(<object>)) is equivalent to rloc(<object>,2). rloc(<object>,0) is equivalent to num(<object>), and rloc(<object>,1) is equivalent to loc(<object>).
If rloc() encounters a room, the dbref of that room is returned. If rloc() encounters an exit, the dbref of that exit's destination is returned. It can also return the locations of controlled or nearby objects, or of findable players.
Related functions: LOC(), WHERE(), ROOM()
RNUM()
- rnum(<room number>, <object>)
This function returns the dbref number of an object (player, thing, or exit). The object must be in the specified room. This function is essentially identical to NUM(), except it matches things in the specified room rather than the room that you are in. The RNUM() function is meant to be used in conjunction with Master Room objects.
ROOM
Flag: ROOM (rooms)
This flag is automatically set on rooms when you @dig a new room. It cannot be changed.
ROOM()
Returns the "absolute" location of an object. This is always a room; it is the container of all other containers of the object. The "absolute" location of an object is the place @lemit messages are sent to and NO_TEL status determined. You must control the object, be a wizard or royalty, or be near the object in order for this function to work. The exception to this are players; if <object> is a player, the ROOM() function may be used to find the player's absolute location if the player is not set UNFINDABLE.
ROOT()
Returns the n-th root of <number>. The 2nd root is the square root, the 3rd the cube root, and so on.
Example:
> think root(27, 3)
3
> think power(3, 3)
27
ROUND()
- round(<number>, <places>)
Rounds <number> to <places> decimal places. <places> must be between 0 and 6.
ROYALTY
Flag: ROYALTY (all types)
If this flag is set on any type of object, then that object will be able to @tel and examine as if it was a wizard. Royalty players are not affected by quotas or restricted building. Royalty is not able to change things like a wizard could. Only wizards may set it on players, although players who are ROYALTY may set their objects ROYALTY.
RQUOTA
This attribute tracks remaining building quota if it is implemented. It is settable in-game only by a wizard, and is only visible to wizards.
Generated at Mon Jul 2 00:35:04 2007