pennfunc.hlp
pennmush-1.8.3p3/game/txt/hlp/pennfunc.hlp · 172.7 KB
From the archive pennmush-1.8.3p3.tar.gz
Download the archive « Back to the archive contents
& FUNCTIONS
Functions are specialized commands used to manipulate strings and
other input. Function take the general form: [FUNCTION(<input>)]
The brackets are used to delimit and force evaluation of the function
(or nested functions). The brackets can also be used to group functions
for the purposes of string concatenation. In general, more than one pair
of brackets is not required, but you can nest an arbitrary number of
brackets.
Examples:
> say [first(rest(This is a nice day))]
You say, "is"
> @va me=This is a
Wizard - Set.
> @vb me=nice day
Wizard - Set.
> say [first([rest([v(va)] [v(vb)])])]
You say, "is"
See "help FUNCTIONS2" for more.
& FUNCTIONS2
A list of available built-in functions can be obtained via the command
"@config/functions". In the help text, the list is under the topic
"FUNCTION LIST".
In addition to these built-in functions are MUSH-defined "global user
functions." These are defined by wizards or those with the "Function"
power, via the "@function" command. To the user, they act just like
the built-in game functions. For details on global user functions,
see "help @function".
See also: MUSHCODE
& FUNCTION LIST
Several major variants of functions are available. The help topics
are listed below, together with a quick summary of the function type
and some examples of that type of function.
Attribute functions: attribute-related manipulations (GET, UFUN)
Bitwise functions: Manipulation of individual bits of numbers (SHL, BOR)
Boolean functions: produce 0 or 1 (false or true) answers (OR, AND)
Channel functions: Get information about channels (CTITLE, CWHO)
Communication functions: Send messages to objects (PEMIT, OEMIT)
Connection functions: Get information about a player's connection (CONN)
Dbref functions: return dbref info related to objects (LOC, LEXITS)
Html functions: output html tags for Pueblo-compatible clients
Information functions: find out something about objects (FLAGS, MONEY)
List functions: manipulate lists (REVWORDS, FIRST)
Mail functions: manipulate @mail (MAIL, FOLDERSTATS)
Math functions: number manipulation, generic or integers only (ADD, DIV)
Regular expression functions: Regular expressions (REGMATCH, REGEDIT)
SQL functions: Access SQL databases (SQL, SQLESCAPE)
String functions: string manipulation (ESCAPE, FLIP)
Time functions: Formatting and display of time (TIME, CONVSECS)
Utility functions: general utilities (ISINT, COMP)
The command "@config/functions" lists all of the game's built-in functions.
The command "@function" lists all of the game's custom global functions
defined via the @function command.
& Attribute functions
The primary purpose of these functions is to access information
stored in attributes on objects.
aposs() attrib_set() default() edefault() eval()
get() grep() grepi() lattr() nattr()
obj() poss() regrep() regrepi() subj()
udefault() ufun() uldefault() ulocal() v-function
wildgrep() wildgrepi() xget() zfun()
See also: ATTRIBUTES, NON-STANDARD ATTRIBUTES
& Bitwise functions
These functions treat integers as a sequence of binary bits (Either 0
or 1) and manipulate them.
For example, 2 is represented as '0010' and 4 as '0100'. If these two
numbers are bitwise-or'ed together with BOR(), the result is 6, or
(In binary) '0110'. These functions are useful for storing small
lists of toggle (Yes/No) options efficiently.
baseconv() band() bnand() bnot() bor()
bxor() shl() shr()
& Boolean functions
Boolean functions all return 0 or 1 as an answer.
Your MUSH may be configured to use traditional PennMUSH booleans,
in which case non-zero numbers, non-negative db#'s, and strings
are all considered "true" when passed to these functions.
Alternatively, your MUSH may be using TinyMUSH 2.2 booleans,
in which case only non-zero numbers are "true".
and() cand() cor() eq() gt()
gte() lt() lte() nand() neq()
nor() not() or() t() xor()
See also: BOOLEAN VALUES, @config
& Communication functions
Communication functions are side-effect functions that send a message
to an object or objects.
cemit() emit() lemit() nsemit() nslemit()
nsoemit() nspemit() nsprompt() nsremit() nszemit()
oemit() pemit() prompt() remit() zemit()
& Connection functions
Connection functions return information about the connections open
on a game, or about specific connections.
cmds() conn() doing() height() hostname()
hidden() idle() ipaddr() lports() lwho()
lwhoid() mwho() mwhoid() nmwho() nwho()
player() ports() pueblo() recv() sent()
ssl() terminfo() width() xmwho() xmwhoid()
xwho() xwhoid() zmwho() zwho()
& Dbref functions
Dbref functions return a dbref or list of dbrefs related to some value
on an object.
children() con() entrances() exit() followers()
following() home() lcon() lexits() loc()
locate() lparent() lplayers() lsearch() lvcon()
lvexits() lvplayers() namelist() next() nextdbref()
num() owner() parent() pmatch() rloc()
rnum() room() where() zone()
See also: DBREF
& Information functions
Information functions return values related to objects or the game.
alias() andflags() andlflags() config() controls()
ctime() elock() findable() flags() fullalias()
fullname() hasattr() hasattrp() hasflag() haspower()
hastype() iname() lflags() lock() lstats()
money() mtime() mudname() name() nattr()
nearby() objid() objmem() orflags() orlflags()
playermem() poll() powers() quota() restarts()
type() version() visible()
& List functions
List functions take at least one list of elements and return transformed
lists or one or more members of those lists. Most of these functions
can take an arbitrary <delimiter> argument to specify what delimits
list elements; if none is provided, a space is used by default.
element() elements() extract() filter() filterbool()
first() fold() grab() graball() index()
insert() itemize() items() iter() last()
ldelete() map() match() matchall() member()
mix() munge() namegrab() namegraball() remove()
replace() rest() revwords() setdiff() setinter()
setunion() shuffle() sort() sortby() sortkey()
splice() step() table() unique() wordpos()
words()
See also: LISTS
& Math functions
Math functions take one or more floating point numbers and return
a numeric value.
abs() acos() add() asin() atan()
atan2() bound() ceil() cos() ctu()
dist2d() dist3d() e() exp() fdiv()
floor() fmod() fraction() ln() lmath()
log() max() mean() median() min()
mul() pi() power() root() round()
sign() sin() sqrt() stddev() sub()
tan() trunc() val()
These functions operate only on integers (if passed floating point
numbers, they will return an error or misbehave):
dec() div() floordiv() inc() mod()
remainder()
These functions operate on n-dimensional vectors. A vector
is a delimiter-separated list of numbers (space-separated, by default):
vadd() vcross() vdim() vdot() vmag()
vmax() vmin() vmul() vsub() vunit()
& 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()
See also: string functions, regexp
& SQL functions
These functions perform queries or other operations on an SQL
database to which the MUSH is connected, if SQL support is
available and enabled.
sql() sqlescape() mapsql()
& String functions
String functions take at least one string and return a transformed
string, parts of a string, or a value related to the string(s).
accent() after() align() alphamin() alphamax()
art() before() brackets() capstr() case()
caseall() cat() center() comp() chr()
decompose() decrypt() delete() digest() edit()
encrypt() escape() if() ifelse() foreach()
lcstr() left() lit() ljust() merge()
mid() ord() ordinal() pos() regedit()
lpos() regmatch() repeat() reverse() right()
rjust() scramble() secure() sha0() space()
spellnum() squish() strcat() strinsert() stripaccents()
stripansi() strlen() strmatch() strreplace() switch()
trim() ucstr() wrap()
See also: STRINGS
& Time functions
These functions return times or format times.
convsecs() convutcsecs() convtime() ctime() etimefmt()
isdaylight() mtime() restarttime() secs() starttime()
stringsecs() time() timefmt() timestring() utctime()
& Utility functions
These functions don't quite fit into any other category.
allof() ansi() atrlock() beep() checkpass()
clone() create() die() dig() firstof()
functions() isdbref() isint() isnum() isobjid()
isword() letq() localize() link() list()
lnum() null() numversion() objeval() open()
pcreate() r-function rand() s-function scan()
set() setq() setr() soundex() soundslike()
speak() tel() textentries() textfile() valid()
wipe() @@()
& @@()
& NULL()
@@(<expression>)
null(<expression>[, ... , <expression>])
The @@() function does nothing and returns nothing. It could be
used for commenting, perhaps. It does not evaluate its argument.
The null() function is similar, but does evaluate its argument(s),
so side-effects can occur within a null(). Useful for eating the
output of functions when you don't use that output.
& ABS()
abs(<number>)
Returns the absolute value of a number. i.e. ABS(-4) returns 4;
ABS(2) returns 2, etc.
& ACCENT()
accent(<string>, <template>)
The accent() function will return <string>, with characters in it
possibly changed to accented ones according to <template>. Both
arguments must be the same size.
Whether or not the resulting string is actually displayed correctly
is client-dependent. Some OSes uses different character sets than
the one assumes (ISO 8859-1), and some clients strip these 8-bit
characters.
See 'HELP ACCENT2' for a description of the template argument.
See also: stripaccents(), NOACCENTS
& ACCENT2
For each character in <string>, the corresponding character of
<template> is checked according to the table below, and a replacement
done. If either the current <string> or <template> characters aren't
in the table, the <string> character is passed through unchanged.
Accent Template String
Name Description Character Character
--------------------------------------------------------------
grave Backward slant ` A,E,I,O,U,a,e,i,o,u
above letter
acute Forward slant ' A,E,I,O,U,Y,a,e,i,o,u,y
above letter
tilde Wavy line above ~ A,N,O,a,n,o
letter
circumflex carat above ^ A,E,I,O,U,a,e,i,o,u
letter
umlaut Two dots above : A,E,I,O,U,,a,e,i,o,u,y
diaeresis letter
ring Small circle above o A,a
letter
cedilla Small tail below , C,c
letter
See 'HELP ACCENT3' for more
& ACCENT3
These are non-accent special characters, mostly punctuation and
non-roman letters.
Template String
Description Character Character
--------------------------------------------------------------
Upside-down ? u ?
Upside-down ! u !
<< quote mark " <
>> quote mark " >
German sharp s B s
Capital thorn | P
Lower-case thorn | p
Capital eth - D
Lower-case eth & o
See 'HELP ACCENT4' for examples
& ACCENT4
Some examples of accent() and their expected outputs:
> think accent(Aule, ---:)
Aul(e-with-diaeresis)
> think accent(The Nina was a ship, The Ni~a was a ship)
The Ni(n-with-~)a was a ship
> think accent(Khazad ai-menu!, Khaz^d ai-m^nu!)
Khaz(a-with-^)d ai-m(e-with-^)nu!
& ACCNAME()
accname(<object>)
accname() returns the name of object <object>, applying the object's
@nameaccent, if any.
Related functions: NAME(), FULLNAME(), INAME()
& ACOS()
acos(<cosine>[,<angle type>])
Returns the angle that has the given <cosine> (arc-cosine), with the
angle expressed in the given angle type, or radians by default.
See 'HELP CTU()' for more on the angle type.
& ADD()
add(<number>, <number>[, ... , <numberN>])
Returns the sum of some numbers.
& AFTER()
after(<string1>, <string2>)
Returns the portion of <string1> that occurs after <string2>.
If <string2> isn't in <string1>, the function returns a null string.
This is case-sensitive.
Examples:
> think after(foo bar baz,bar)
baz
> think after(foo bar baz,ba)
r baz
See also: before(), rest()
& ALIGN()
align(<widths>,<col1>,...,<coln>[,<filler>[,<colsep>[,<rowsep>]]])
Creates columns of text, each column designated by <col1..coln>.
Each column is individually wrapped inside its own column, allowing
for easy creation of book pages, newsletters, or the like.
<widths> is a space-separated list of column widths. '10 10 10' for the
widths argument specifies that there are 3 columns, each 10 spaces wide.
< before a number causes the field to be left-aligned (the default). A
'-' causes it to be centered, and '>' makes it right-aligned.
A '.' after the number implies the column is to be repeated for as long
as there is text remaining in a non-repeating column. A ` (left tick)
after the number implies that if the column runs out of text, it should
merge with the next leftmost column (making that column flow around).
A ' (right tick) after the number implies that if the column runs out
of text, it should merge with the next rightmost column.
<filler> is a single character that, if given, is the character used
to fill empty columns and remaining spaces. <colsep>, if given, is
inserted between every column, on every row. <rowsep>, if given, is
inserted between every line. By default, <filler> and <colsep> are
a space, and <rowsep> is a newline.
Continued in HELP ALIGN2
& ALIGN2
Examples:
> &line me=align(<5 10 20,\([left(xget(%0,sex),1)]\),name(%0),name(loc(%0)))
> th iter(lwho(),u(line,##),%b,%r)
(M) Walker Tree
(F) Jane Doe Nowhere
> &haiku me = Alignment function,%rIt justifies your writing,%rBut the
words still suck.%rLuke
> th [align(5 -40 5,,[repeat(-,40)]%r[u(haiku)]%r[repeat(-,40)],,%b,+)
+----------------------------------------+
+ Alignment function, +
+ It justifies your writing, +
+ But the words still suck. +
+ Luke +
+----------------------------------------+
See also: center(), ljust(), rjust()
& ALLOF()
allof(<expr1>[, ... , <exprN>],<osep>)
Evaluates every expression argument (including side-effects) and returns
the results of those which are true, in a list separated by osep. The
output separator argument is required and must be a single character,
or can be left empty, in which case a space will be used to separate the
results by default.
The meaning of true or false depends on configuration options as
explained in the 'BOOLEAN VALUES' help topics.
> &s me=Bats are similar to Rats which are afraid of Cats
> say allof(grab(v(s),rats),grab(v(s),mats),grab(v(s),bats),)
You say, "Rats Bats"
> say allof(#-1,#101,#2970,,#-3,0,#319,null(This Doesn't Count),|)
You say, "#101|#2970|#319"
See also: firstof(), BOOLEAN VALUES
& ALPHAMAX()
alphamax(<word1>[, ... , <wordN>])
Takes any number of arguments, and returns the word which is
lexicographically biggest. I.e., which word would be last in
alphabetical order.
& ALPHAMIN()
alphamin(<word1>[, ... , <wordN>])
Takes any number of arguments, and returns the word which is
lexicographically smallest: the word that would be first in
alphabetical order.
& AND()
& CAND()
and(<boolean value 1>, <boolean value 2>[, ... , <boolean value N>])
cand(<boolean value 1>, <boolean value 2>[, ... , <boolean value N>])
Takes boolean values, and returns 1 if all of them are equivalent
to true(1). and() always evaluates all arguments (including side
effects), while cand() stops evaluation after the first argument
that evaluates to false.
See also: BOOLEAN VALUES, or(), xor(), not()
& ANDFLAGS()
andflags(<object>,<string of flag letters>)
This function returns 1 if <object> has all the flags in a specified
string, and 0 if it does not. The string is specified with a single
letter standing for each flag, like the output of the FLAGS()
function. A '!' preceding a flag letter means "not flag".
Thus, ANDFLAGS(me,WD) would return 1 if I was set WIZARD and DARK.
ANDFLAGS(me,W!Dc) would return 1 if I was set WIZARD, not DARK,
and CONNECTED.
If a letter does not correspond to any flag, <object> doesn't have it,
so the function returns 0. There can be an arbitrary number of flags. Do
not put spaces between flag letters.
& ANDLFLAGS()
andlflags(<object>, <list of flags>)
This function returns 1 if <object> has all the flags in a specified
list, and 0 if it does not. The list is a space-separated list of
flag names. A '!' preceding a flag name means "not flag".
Thus, ANDLFLAGS(me,wizard dark) would return 1 if I was set WIZARD
and DARK. ANDFLAGS(me,wizard !Dark connected) would return 1 if I
was set WIZARD, not DARK, and CONNECTED.
If a name does not correspond to any flag, <object> doesn't have it,
so the function returns 0. There can be an arbitrary number of flags.
& ANSI()
ansi(<codes>, <string>)
This allows you to highlight a string using ANSI terminal effects.
The codes are:
f - flash F - not flash
h - hilite H - not hilite
u - underscore U - not underscore
i - inverse I - not inverse
n - normal
d - default foreground D - default background
x - black foreground X - black background
r - red foreground R - red background
g - green foreground G - green background
y - yellow foreground Y - yellow background
b - blue foreground B - blue background
m - magenta foreground M - magenta background
c - cyan foreground C - cyan background
w - white foreground W - white background
For example, "ansi(fc, Test)" would hilight "Test" in flashing cyan.
Default foreground and background use the client's default color for
fore and back.
See also: ANSI, COLOR
& APOSS()
aposs(<object>)
Returns the absolute possessive pronoun - his/hers/its/theirs -
for an object.
& ART()
art(<string>)
This function returns the proper article, "a" or "an", based on whether
or not <string> begins with a vowel.
& ASIN()
asin(<sine>[,<angle type>])
Returns the angle with the given <sine> (arc-sine), with the angle
expressed in the given angle type, or radians by default.
See 'HELP CTU()' for more on the angle type.
& ATAN()
& ATAN2()
atan(<tangent>[,<angle type>])
atan2(<number>, <number>[,<angle type>])
Returns the angle with the given <tangent> (arc-tangent), with the
angle expressed in the given angle type, or radians by default.
atan2(y, x) is like atan(fdiv(y, x)), except x can be 0, and the
signs of both arguments are used in determining the sign of the
result. It is useful in converting between cartesian and polar
coordinates.
See 'HELP CTU()' for more on the angle type.
& ATRLOCK()
atrlock(<object>/<attrib>[, <on|off>])
When given a single object/attribute pair as an argument, returns 1
if the attribute is locked, 0 if unlocked, and #-1 if the attribute
doesn't exist or can't be read by the function's caller.
When given a second argument of "on" (or "off"), attempts to lock
(unlock) the specified attribute, as per @atrlock.
& ATTRIB_SET()
attrib_set(<object>/<attrib>[, <value>])
Sets or clears an attribute. With a value, it sets the attribute,
without one, it clears the attribute. This is an easier-to-read
replacement for the old set(<object>, <attrib>:<value>) notation,
and a less destructive replacement for wipe() that won't destroy
entire attribute trees in one shot.
If there is a second argument, then attrib_set() will create an
attribute, even if the second argument is empty (in which case
attrib_set() will create an empty attribute). This means that
attrib_set(me/foo,%0) will _always_ create an attribute.
Of course, if the empty_attrs configuration option is turned off,
then the above paragraph doesn't apply. See '@config attribs'.
& BAND()
band(<integer1>, <integer2>[, ... , <integerN>])
Does a bitwise AND of all its arguments, returning the result
(A number with only the bits set in every argument set in it).
& BASECONV()
baseconv(<number>, <from base>, <to base>)
Converts <number>, which is in base <from base> into base <to base>.
The bases can be between 2 (binary) and 36.
& BEEP()
beep([<number>])
Sends <number> "alert" bell characters. <number> must be in the range
1 to 5, or, if unspecified, defaults to 1.
This function may only be used by royalty and wizards.
& BEFORE()
before(<string1>, <string2>)
Returns the portion of <string1> that occurs before <string2>.
If <string2> isn't in <string1>, <string1> is returned.
This is case-sensitive.
Examples:
> think before(foo bar baz,bar)
foo
> think before(foo bar baz,r)
foo ba
See also: after(), first()
& BRACKETS()
brackets([<string>])
Returns a count of the number of left and right square brackets,
parentheses, and curly braces in the string, in that order, as a
space-separated list of numbers. This is useful for finding missing
or extra brackets in MUSH code.
Example:
> @desc me=This is [ansi(h,a test)] of the { brackets() function.
> think brackets(v(desc))
1 1 2 2 1 0
& BNAND()
bnand(<integer>, <integer>)
Returns its first argument with every bit that was set in the second
argument cleared.
& BNOT()
bnot(<integer>)
Returns the bitwise complement of its argument. Every bit set in it
is cleared, and every clear bit is set.
& BOR()
bor(<integer>, <integer>[, ... , <integerN>])
Does a bitwise OR of all its arguments, returning the result.
(A number with a bit set if that bit appears in any of its arguments).
& BOUND()
bound(<number>, <lower bound>, <higher bound>)
bound() returns <number> if it is between <lower bound> and
<higher bound>. If it's lower than the lower bound, the lower
bound is returned. If it's higher than the higher bound,
the higher bound is returned.
See also: ceil(), floor(), round(), trunc()
& BXOR()
bxor(<integer>, <integer>[, ... , <integerN>])
Does a bitwise XOR of all its arguments, returning the result.
(A number with a bit set if it's set in only one of its arguments).
& CAPSTR()
capstr(<string>)
Returns <string> with the first character capitalized.
Example: capstr(foo bar baz) returns "Foo bar baz"
See also: lcstr(), ucstr()
& CAT()
cat(<string1>[, ... , <stringN>])
cat() concatenates strings, separating each string by a space.
So "[cat(one, two)]" will return 'one two'.
See also: strcat()
& CEIL()
ceil(<number>)
Returns the least integral value greater than or equal to <number>.
See also: floor(), bound(), round(), trunc()
& CENTER()
center(<string>, <width>[, <fill>[, <rightfill>]])
This function will center <string> within a field <width> characters wide,
using the <fill> string for padding on the left side of the string,
and <rightfill> for padding on the right side. <rightfill> defaults
to the mirror-image of <fill> if not specified. <fill> defaults to
a space if neither <fill> nor <rightfill> are specified.
If <string> divides <width> into uneven portions, the left side
will be one character shorter than the right side.
Examples:
> say center(X,5,-)
You say, "--X--"
> say center(X,5,-=)
You say, "-=X=-"
> say center(.NEAT.,15,-,=)
You say, "----.NEAT.====="
> say center(hello,16,12345)
You say, "12345hello543215"
See also: align(), ljust(), rjust()
& CHECKPASS()
checkpass(<player>, <string>)
Returns 1 if <string> matches the player's password otherwise 0.
If <player> has no password, this function will always return 1.
<player> should be specified as a dbref or *<name>.
This function is restricted to wizards.
& CHR()
& ORD()
chr(<number>)
ord(<character>)
ord() returns the numerical value of the given character.
chr() returns the character with the given numerical value.
Examples:
> think ord(A)
65
> think chr(65)
A
& CLONE()
clone(<object>)
This function clones <object>, and returns the dbref number of the clone.
This is a side-effect function and may not be enabled on some MUSHes.
& CMDS()
cmds(<player|descriptor>)
Returns the number of commands issued by a player during this
connection as indicated by WHO.
The caller can use the function on himself, but using on any other
player requires privileged power such as Wizard, Royalty or SEE_ALL.
See also: Connection Functions
& SENT()
sent(<player|descriptor>)
Returns the number of characters sent 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.
See also: Connection Functions
& 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.
See also: Connection Functions
& COMP()
comp(<value1>, <value2>[,<type>])
Comp compares two values. It returns 0 if they are the same, -1 if
value1 is less than/precedes alphabetically value2, and 1
otherwise.
By default the comparison is a case-sensitive lexicographic (string)
comparison. By giving the optional <type>, the comparison can
be specified:
<type> Comparison
A Maybe case-sensitive lexicographic (default)
I Always case-insensitive lexicographic
D Dbrefs of valid objects
N Integers
F Floating point numbers
Whether or not the a sort type is case-sensitive or not depends
on the particular mush and its environment.
& CON()
con(<object>)
Returns the dbref of the first object in a container.
You can get the complete contents of any container you may examine,
regardless of whether or not objects are dark. You can get the
partial contents (obeying DARK/LIGHT/etc.) of your current location
or the enactor (%#). You CANNOT get the contents of anything else,
regardless of whether or not you have objects in it.
See also: lcon(), next()
& CONFIG()
config()
config(<option>)
With no arguments, this function returns a list of config option names.
Given a config option name, this function returns its value.
Boolean configuration options will return values of "Yes" or "No".
Ex: config(money_singular) => "Penny"
& CONN()
conn(<player|descriptor>)
This function returns the number of seconds a player has been connected.
<player name> must be the full name of a player, or a player's dbref.
Players who are not connected have a conn value of "-1", as do dark
wizards, when conn() is used on them by a non-priv'ed player.
See also: CONNECTED
& CONTROLS()
controls(<object>, <victim>)
This function returns 1 if <object> controls <victim>, or 0, if
it does not. If one of the objects does not exist, it will return
#-1 ARGN NOT FOUND (where N is the argument which is the invalid
object). You must control <object> or <victim>, or have the See_All
power, to use this function.
See also: CONTROL
& CONVSECS()
& CONVUTCSECS()
convsecs(<seconds>[, <zone>])
convutcsecs(<seconds>)
This function converts seconds to a time string, based on how many
seconds the number is after Jan 1, 1970 UTC. Because it's based on
UTC, but returns local time, convsecs(0) is not going to be
"Thu Jan 1 00:00:00 1970" unless you're in the UTC (GMT) timezone.
convutcsecs() and convsecs() with a second argument of 'utc' return
the time based on UTC time instead of the server's local time.
Examples:
> say [secs()]
You say, "709395750"
> say [convsecs(709395750)]
You say, "Wed Jun 24 10:22:54 1992"
> say [convutcsecs(709395750)]
You say, "Wed Jun 24 14:22:30 1992"
See also: convtime(), time()
& CONVTIME()
convtime(<time string>)
This functions converts a time string (in the local time zone) to the
number of seconds since Jan 1, 1970 GMT. A time string is of the
format: Ddd MMM DD HH:MM:SS YYYY where Ddd is the day of the week,
MMM is the month, DD is the day of the month, HH is the hour in
24-hour time, MM is the minutes, SS is the seconds, and YYYY is the
year. If you supply an incorrectly formatted string, it will return
-1.
If the extended convtime() is supported (See @config compile), more
formats for the date are enabled, including ones missing the day
of week and year, and a 'Month Day Year' format.
Example:
> say [time()]
You say, "Wed Jun 24 10:22:54 1992"
> say [convtime(Wed Jun 24 10:22:54 1992)]
You say, "709395774"
See also: convsecs(), time()
& COS()
cos(<angle>[,<angle type>])
Returns the cosine of <angle>. Angle must be in the given angle
type, or radians by default.
Examples:
> say cos(90, d)
You say, "0"
> say cos(1.570796)
You say, "0"
See 'HELP CTU()' for more on the angle type.
& PCREATE()
pcreate(<name>, <password>)
Creates a player with a given name and password. Wizard-only.
See also: @pcreate
& CREATE()
create(<object>, <cost>)
This function creates an object with name <object> for <cost> pennies,
and returns the dbref number of the created object.
This is a side-effect function and may not be enabled on some MUSHes.
& CTIME()
& CSECS()
ctime(<object>[, <utc>])
csecs(<objecct>)
If creation times are enabled, this function will return the
date and time that the object was created. If the optional <utc>
argument is true, the time is returned for the UTC time zone, if
false or present, for the local time zone.
csecs() returns the time as the number of seconds since the epoch.
You must be able to examine an object to see its creation time.
See also: mtime()
& CTU()
ctu(<angle>,<from>,<to>)
Converts between the different ways to measure angles.
<from> controls what the angle is treated as, and <to> what form
it is turned into. They can be 'd' for degrees, or 'r' for radians.
There is also a third way to measure angle, 'g' for gradians, but it's not
used often and is only included for completeness.
As a refresher, there are 180 degrees in pi radians in 200 gradians.
Example:
> say 90 degrees is [ctu(90, d, r)] radians
You say, "90 degrees is 1.570796 radians"
& DEC()
dec(<integer>)
dec(<string-ending-in-integer>)
Dec returns the integer minus 1. If given a string that ends in an integer,
it decrements only the final integer portion. That is:
> think dec(3)
2
> think dec(hi3)
hi2
> think dec(1.3.3)
1.3.2
> think dec(1.3)
1.2
Note especially the last example, which will trip you up if you use
floating point numbers with dec() and expect it to work like sub().
See also: inc()
& DECOMPOSE()
decompose(<string>)
decompose() works like escape() with the additional caveat that it inserts
parse-able characters to recreate <string> exactly after one parsing. It
takes care of multiple spaces, '%r's, and '%t's.
See also: @decompile2, escape(), secure()
& DECRYPT()
decrypt(<string>, <password>)
Decrypts a string encrypted with the encrypt() function, if given
the string and the same password.
& DEFAULT()
default([<obj>/]<attr>[, ... ,[<obj>]/<attr>], <default case>)
This function returns the value of the first possible <obj>/<attr>,
as if retrieved via the get() function, if the attribute exists and
is readable by you. Otherwise, it evaluates the default case, and
returns that. Note that the default case is only evaluated if the
attribute does not exist or cannot be read. Note further than an empty
attribute counts as an existing attribute.
This is useful for code that needs to return the value of an attribute,
or an error message or default case, if that attribute does not exist.
Examples:
> &TEST me=apple orange banana
> say default(me/Test, No fruits!)
You say "apple orange banana"
> &TEST ME
> say default(me/Test, No fruits!)
You say "No fruits!"
See also: get(), eval(), ufun(), edefault(), udefault(), uldefault()
& DELETE()
delete(<string>, <first>, <len>)
Return a modified <string>, with <len> characters starting after the
character at position <first> deleted. In other words, it copies <first>
characters, skips <len> characters>, and then copies the remainder of
the string. If <len> is negative, deletes characters leftwards from <first>.
Characters are numbered starting at 0.
Examples:
> say delete(abcdefgh, 3, 2)
You say, "abcfgh"
> say delete(abcdefgh, 3, -2)
You say, "abefgh"
See also: strreplace()
& DIE()
die(<number of times to roll die>, <number of sides on die>[, <show>])
This function simulates rolling dice. It "rolls" a die with a given
number of sides, a certain number of times, and sums the results.
For example, DIE(2, 6) would roll "2d6" - two six-sided dice,
generating a result in the range 2-12. The maximum number of
dice this function will roll in a single call is 20.
If a third argument is given and it's a true value, the result will
be a space-seperated list of the individual rolls rather than their
sum.
Examples:
> think die(3, 6)
6
> think die(3, 6, 1)
5 2 1
& DIG()
dig(<name>[, <exit to>[, <exit from>]])
This function digs a room called <name>, and optionally opens and links
<exit to> and <exit from>, like the normal @dig command. It returns
the dbref number of the new room.
This is a side-effect function and may not be enabled on some MUSHes.
& DIGEST()
digest(<algorithm>, <string>)
Returns a checksum (Hash, digest, etc.) of <string> using the given
<algorithm>. If the mush is compiled with SSL support (See @config
compile), <algorithm> can be one of:
md2 md4 md5 sha sha1 dss1 mdc2 ripemd160
Without SSL, only the sha algorithm is enabled. In both cases, sha returns
the same thing as the sha0() function.
See also: sha0()
& DIST2D()
dist2d(<x1>, <y1>, <x2>, <y2>)
Returns the distance between two points in the Cartesian
plane that have coordinates (<x1>, <y1>) and (<x2>, <y2>).
& DIST3D()
dist3d(<x1>, <y1>, <z1>, <x2>, <y2>, <z2>)
Returns the distance between two points in space, with
coordinates (<x1>, <y1>, <z1>) and (<x2>, <y2>, <z2>).
& DIV()
& FLOORDIV()
div(<number>, <number>)
floordiv(<number>, <number>)
Div returns the integer part of the quotient of the first number
divided by the second number. Floordiv returns the largest integer
less than or equal to the quotient of the first number divided by
the second. For positive numbers, these are the same thing, but
for negative numbers they may be different:
div(13,4) ==> 3 and floordiv(13,4) ==> 3
div(-13,4) ==> -3 but floordiv(-13,4) ==> -4
div(13,-4) ==> -3 but floordiv(13,-4) ==> -4
div(-13,-4) ==> 3 and floordiv(-13,-4) ==> 3
Note that add(mul(div(%0,%1),%1),remainder(%0,%1)) always yields %0,
and add(mul(floordiv(%0,%1),%1),modulo(%0,%1)) also always yields %0.
See also: modulo(), fdiv()
& DOING()
doing(<player|descriptor>)
Given the name of a connected player, returns that player's @doing
string if they can be seen on the WHO list.
See also: @poll, @doing, poll()
& E()
e()
Returns the value of "e" (2.71828182845904523536, rounded to the
game's float_precision setting).
& EDEFAULT()
edefault([<obj>/]<attr>, <default case>)
This function returns the evaluated value of <obj>/<attr>, as if
retrieved via the get_eval() function, if the attribute exists and
is readable by you. Otherwise, it evaluates the default case, and
returns that. The default case is only evaluated if the attribute
does not exist or cannot be read.
Example:
> &TEST me=You have lost [rand(10)] marbles.
> say edefault(me/Test,You have no marbles.)
You say "You have lost 6 marbles."
> &TEST me
> say edefault(me/Test,You have no marbles.)
You say "You have no marbles."
See also: get(), eval(), ufun(), default(), udefault()
& EDIT()
edit(<string>, <search>, <replace>[, ... , <searchN>, <replaceN>])
This functions in a similar way to the @edit command; instead of
taking an attribute from an object, it takes an arbitrary string.
It searches the string for <search> and replaces with <replace>,
then repeats the process if additional search-replace pairs are
given.
If <search> is a caret (^), <replace> is prepended.
If <search> is a dollar sign ($), <replace> is appended.
If <search> is an empty string, <replace> is inserted between
every character, and before the first and after the last.
If <replace> is an empty string, <search> is deleted from the string.
Example:
> say [edit(this is a test,^,I think%b,$,.,a test,an exam)]
You say "I think this is an exam."
edit() can not replace a literal single ^ or $. Use regedit() for that.
See also: @edit, regedit()
& ELEMENT()
element(<list>, <item>,<single-character separator>)
This returns the position of <item> in <list>, where <list>'s items
are separated by <separator>. A wildcard match is done, so this
function behaves much like MATCH(), except its separator argument
is required, not optional.
Example:
> say [element(this|is|a|test|string,is,|)]
You say, "2"
See also: match(), grab()
& ELEMENTS()
elements(<list of words>, <list of numbers>[,<delim>[, <osep>]])
This function returns the words in <list of words> that are in the
positions specified by <list of numbers>. Optionally, a list delimiter
other than a space can be used.
Examples:
> say elements(Foo Ack Beep Moo Zot,2 4)
You say "Ack Moo"
> say elements(Foof|Ack|Beep|Moo,3 1,|)
You say "Beep|Foof"
See also: extract(), index(), grab()
& ELOCK()
elock(<object>[/<locktype>], <victim>)
elock() returns 1 if the <victim> would pass the lock on <object>,
and 0 if it would fail. You must control <object>.
You can also provide a switch after <object> if you wish to check
something other than the basic lock. This can be used to test
user-defined locks. elock() can take as many switches as @lock.
For example:
@lock/drop Dancing Slippers=#0
think elock(Dancing Slippers/drop, Princess)
> 0
See also: @lock, locktypes
& EMIT()
& NSEMIT()
emit(<message>)
nsemit(<message>)
Sends a message to the room, as per @emit.
nsemit() is a wizard-only variation that works like @nsemit.
& ENCRYPT()
encrypt(<string>, <password>)
Returns an encrypted string produced by a simple password-based
encrypted algorithm. Good passwords are long passwords.
This is not high-security encryption.
See also: decrypt()
& ENTRANCES()
entrances([<object> [,<type>[, <begin>[, <end>]]]])
With no arguments, the entrances() function returns a list of all
exits, things, players, and rooms linked to your location, like
@entrances. You can specify an object other than your current location
with <object>. You can limit the type of objects found by specifying
<type> as follows:
a all (default)
e exits
t things
p players
r rooms
You can also limit the range of the dbrefs searched by giving <begin>
and <end>.
This function is computationally expensive and costs the same as
@find. You must control the object in order to perform entrances()
on it.
& EQ()
eq(<number1>, <number2>)
Takes two numbers, and returns 1 if they are equal, 0 otherwise.
See also: neq()
& ESCAPE()
escape(<string>)
The ESCAPE() function "escapes out" potentially "dangerous" characters,
preventing function evaluation in the next pass of the parser. It
returns <string> after adding the escape character ('\') at the
beginning of the string, and before the following characters:
% ; [ ] { } \ ( ) , ^ $
This function prevents strings entered by players from causing side
effects, such as performing an unintended GET() of an attribute. It
is only needed when the resulting string will be passed through @force
or used as an attribute for an object (like the description of a mail
message object). Since the function preserves the original string,
it is, in most cases, a better choice than SECURE().
See also: decompose(), secure()
& EVAL()
& GET_EVAL()
eval(<object>, <attribute>)
get_eval(<object>/<attribute>)
Eval() works the same way as xget(), except that it performs %-substitutions
and function evaluation on the attribute before returning the value. eval()
does not modify the stack (%0-%9), so the attribute being evaled sees the
same values for them that the calling code does. Unless you need this behavior,
it is better to use u() instead, which hides the caller's stack.
Example:
&TEST me=%B%B%B-[name(me)]
think xget(me,test)
> %B%B%B-[name(me)]
think eval(me,test)
> -Shalott
Get_eval() does the same thing, except it uses the format of get() instead
of xget() -- using a slash rather than a comma to separate the object from
the attribute. It is included for TinyMUSH 2.x compatibility.
See also: get(), u(), xget()
& EXIT()
exit(<object>)
Returns the dbref of the first exit in a room.
You can get the complete exit list of any room you may examine,
regardless of whether or not exits are dark. You can get the partial
exit list (obeying DARK/LIGHT/etc.) of your current location or the
enactor (%#). You CANNOT get the exit list of anything else,
regardless of whether or not you have objects in it.
See also: lexits(), next()
& EXP()
exp(<number>)
Returns e to the power of <number>.
& EXTRACT()
extract(<list>[, <first>[, <length>[,<delimiter>]]])
This function returns <length> elements of a list, counting
from the <first> element. If <length> is not specified, the
default is 1, so extract(list,3) acts like elements(list,3).
If <first> is not specified, the default is the 1, so
extract(list) acts like first(list).
For example:
think extract(This is a test string,3,2)
> a test
See also: index(), elements(), grab()
& FDIV()
fdiv(<numerator>, <denominator>)
Returns the quotient of the two numbers. Note that the DIV() and MOD()
functions cannot be used on floating point numbers.
See also: div()
& FILTER()
& FILTERBOOL()
filter([<obj>/]<attr>, <list>[,<delimiter>[, <osep>]])
filterbool([<obj>]/<attr>, <list>[,<delimiter>[, <osep>]])
This function returns the elements of <list> for which a user-defined
function evaluates to "1", or to a boolean true value if filterbool()
is used. That function is specified by the first argument (just as
with the ufun() function), and the element of the list being tested is
passed to that user-defined function as %0.
Thus, "filter(obj/attr, x1 x2 x3)" is nearly equivalent to
"iter(x1 x2 x3, switch(ufun(obj/attr, ##),1,##,))"
though the iter version may have extra blank spaces.
Example:
> &IS_ODD test=[mod(%0,2)]
> say [filter(test/is_odd, 1 2 3 4 5 6)]
You say, "1 3 5"
See also: anonymous attributes
& FINDABLE()
findable(<object>, <victim>)
This function returns 1 if <object> can locate <victim>, or 0, if
it cannot. If one of the objects does not exist, it will return
#-1 ARGN NOT FOUND (where N is the argument which is the invalid
object).
& FIRST()
first(<list>[,<delimiter>])
Returns the first element of a list.
See also: before(), rest(), last()
& FIRSTOF()
firstof(<expr1>, <expr2>[, ... , <exprN>])
Returns the first evaluated expression that is true. If no arguments
are true, then the last argument, <exprN>, is returned as the default
expression, whether it is true or false.
The meaning of true or false is dependent on configuration options
as explained in the 'BOOLEAN VALUES' help topics.
This function does evaluate each argument while testing, including
side-effects, stopping (short-circuits) when the true expression is
found.
> say firstof(0,2)
You say, "2"
> say firstof(10,11,0)
You say, "10"
> say firstof(grab(the cat,mommy),grab(in the hat,daddy),#-1 Error)
You say, "#-1 Error"
> say firstof(get(%#/royal cheese),#-1 This Has No Meaning,0,)
You say, ""
See also: allof(), BOOLEAN VALUES
& FLAGS()
flags(<object>)
flags(<object>/<attribute>)
flags()
Flags returns a string consisting of the flags attached to the
object or the attribute on the object. The string is a single word
made up of all the appropriate flag letters.
Given no arguments, this function returns a string consisting of
all the flag letters of all the flags the server knows. Note that
some flags may not have flag letters, and multiple flags may have
the same letter (and will appear twice).
See also: lflags()
& LFLAGS()
lflags(<object>)
lflags(<object>/<attribute>)
lflags()
Lflags returns a space-separated list consisting of the names of flags
attached to the object or the attribute on the object.
Given no arguments, this function returns a space-separated list
of all flag names known to the server.
See also: flags()
& FLIP()
& REVERSE()
flip(<string>)
reverse(<string>)
This function reverses a string. For example, "flip(foo bar baz)"
returns "zab rab oof".
See also: revwords()
& FLOOR()
floor(<number>)
Returns the greatest integral value less than or equal to <number>.
See also: ceil(), bound(), round(), trunc()
& FMOD()
fmod(<number>, <divisor>)
Identical to mod() but may take floating point arguments. The return
value is the (possibly floating point) smallest positive remainder
left after subtracting the largest number of multiples of <divisor>
from <number>.
Example:
> think fmod(6.1,2.5)
1.1
& FOLD()
fold([<obj>/]<attr>, <list>[, <base case>[,<delimiter>]])
This function "folds" a list through a user-defined function, specified
by the first argument to fold(), which is analogous to ufun()'s first
argument.
If no base case is provided, fold() passes the first element of <list>
as %0, and the second element of <list> as %1, to the user-defined
function. The user-defined function is then called again, with the
result of the first evaluation being %0, and the next (third) element
of the list as %1. This is repeated until all the elements of the
list have been used.
If a base case is provided, it is passed as %0, and the first element
of list is passed as %1, to the user-defined function. The process for
the no-base-case fold() is then used.
See 'help FOLD2' for examples.
& FOLD2
Examples:
> &REP_NUM test=%0[repeat(%1,%1)]
> say [fold(test/rep_num,1 2 3 4 5)]
You say, "122333444455555"
> say [fold(test/rep_num,1 2 3 4 5,List:)]
You say, "List:122333444455555"
> &ADD_NUMS test=add(%0,%1)
> say [fold(test/add_nums,1 2 3 4 5)]
You say, "15"
See also: anonymous attributes
& FOLLOWERS()
followers(<object>)
Returns the list of things and players following object. You must
control object.
& FOLLOWING()
following(<object>)
Returns the list of things and players that the object is following.
You must control object.
& FOREACH()
foreach([<object>/]<attribute>, <string>[, <start>[, <end>]])
Maps a function onto a string.
Each character in <string> has the user-defined function of the first
argument performed on it; the character is passed to the function as
%0, and its position in the string as %1 (the first character has
position 0). The results are concatenated. If a start character is given,
everything before that character is copied without passing it to the
function, and everything after it until the end of the string or an end
character is passed to the function. Anything left after the end character
is also copied unevaluated. The start and end characters themselves are
not copied.
Continued in HELP FOREACH2
& FOREACH2
Examples:
> &add_one me=[add(%0,1)]
> say [foreach(add_one, 54321)]
You say, "65432"
> say [foreach(add_one, This is #0# number, #, #)]
You say, "This is 1 number"
> &is_alphanum me=[regmatch(%0, \[\[:alnum:\]\])]%b
> say [foreach(is_alphanum,jt1o+)]
You say, "1 1 1 1 0 "
See also: anonymous attributes
& FRACTION()
fraction(<number>)
This function returns a fraction representing the floating-point <number>.
Since not all numbers can be expressed as a fraction, dividing the
numerator by the denominator of the results will not always return the
original <number>, but something close to it.
Examples:
> think fraction(.75)
3/4
> think fraction(pi())
348987/111086
> think fraction(2)
2
& FULLNAME()
fullname(<object>)
Fullname() returns the name of object <object>. It is identical to
name() except that for exits, fullname() returns the complete
exit name, including all aliases.
>"[fullname(south)]
You say, "South;sout;sou;so;s"
Related functions: NAME(), ACCNAME(), INAME()
& FUNCTIONS()
functions()
Returns a space-separated list of the names of all function.
& GET()
get(<object>/<attribute>)
The get() function returns the string stored in an object's attribute.
You may get the attributes of objects you control, the attributes you
own on other objects, and publicly accessible attributes.
& GRAB()
& REGRAB()
& REGRABI()
grab(<list>, <pattern>[,<delimiter>])
regrab(<list>, <regexp>[,<delimiter>])
regrabi(<list>, <regexp>[,<delimiter>])
This function returns the first word in list which matches the pattern.
For grab(), the pattern is specified as in match(); i.e., it
can contain wildcards. For regrab(), the pattern is a regular expression.
regrabi() is case-insensitive.
Basically, this is a much more efficient way to do:
extract(list, match(list, pattern, delimiter), 1, delimiter) or
the regular expression variation thereof.
See also: match(), extract(), element(), elements(), index(), regmatch(),
graball()
& GRABALL()
& REGRABALL()
& REGRABALLI()
graball(<list>, <pattern>[,<delim>[, <output separator>]])
regraball(<list>, <regexp>[,<delim>[, <output separator>]])
regraballi(<list>, <regexp>[,<delim>[, <output separator>]])
These functions work identically to the grab() and regrab()/regrabi()
functions, save that they return all matches, not just the first: They
return all words in the <list> which match <pattern>.
If none match, an empty string is returned.
Examples:
> say graball(This is a test of a test,test)
You say "test test"
> say graball(This is testing a test,tes*)
You say "testing test"
> say regraball(This is testing a test,s$)
You say "This is"
See also: match(), matchall(), grab(), regmatch()
& GREP()
& REGREP()
& WILDGREP()
& GREPI()
& REGREPI()
& WILDGREPI()
grep(<object>, <attrs>, <substring>)
wildgrep(<object>, <attrs>, <pattern>)
regrep(<object>, <attrs>, <regexp>)
grepi(<object>, <attrs>, <substring>)
regrepi(<object>, <attrs>, <regexp>)
wildgrepi(<object>, <attrs>, <pattern>)
These functions return a list of attributes on <object> containing
<substring>, matching the wildcard <pattern>, or matching the regular
expression <regexp>. <attrs> is a wildcard pattern for attribute
names to search.
Parsing _does_ occur before this function is invoked. Therefore,
"special" characters will need to be escaped out.
grep()/wildgrep()/regrep() are case-sensitive.
grepi()/wildgrepi()/regrepi() are case-insensitive.
& GT()
gt(<num>, <num>)
Takes two numbers, and returns 1 if and only if the first is greater
than the second, and 0 otherwise.
& GTE()
gte(<num>, <num>)
Takes two numbers, and returns 1 if and only if the first is greater
than or equal to the second, and 0 otherwise.
& HASATTR()
& HASATTRP()
& HASATTRVAL()
& HASATTRPVAL()
hasattr(<object>, <attribute name>)
hasattrp(<object>, <attribute name>)
hasattrval(<object>, <attribute name>)
hasattrpval(<object>, <attribute name>)
The hasattr() functions check to see if an object has an attribute.
They return #-1 if the object does not exist or the attribute can't
be examined by the player. Otherwise, they return 1 if the attribute
is present and 0 if it is not.
hasattr() returns 1 if the object has the attribute, 0 if it doesn't.
hasattrp() also checks for attributes inherited from parent objects.
hasattrval() returns 1 if the attribute exists and isn't empty.
hasattrpval() is hasattrval() but checks parents.
& HASFLAG()
hasflag(<object>[/<attrib>], <flag name>)
Returns 1 if the object has the named flag, and 0 if it does not.
If the object does not exist, #-1 will be returned. You do not have
to control the object.
Example: hasflag(me, opaque) will return "1" or "0".
Unlike orflags() and andflags(), hasflag uses the *flag name*, not
the single character abbreviation. Many flag names have shorter
abbreviations which will also work (W for Wizard, roy for royalty).
The "flags" ROOM, EXIT, and PLAYER are actually types. If you want
to check if an object "has" one of these flags, you must use the
HASTYPE() function.
If an attribute is given, checks to see if the attribute has the
given attribute flag. See 'help attribute flags' for attribute flag names.
See also: orlflags(), andlflags(), orflags(), andflags()
& HASPOWER()
haspower(<object>, <power name>)
Returns 1 if the object has the named power, and 0 if it does not.
If the object does not exist, #-1 will be returned.
You may or may not have to be able to examine the object to use this.
& HASTYPE()
hastype(<object>, <type list>)
Returns 1 if the object is of the named type, otherwise 0.
Valid types are: ROOM, EXIT, PLAYER, THING, GARBAGE. You can
test to see if the object is one of a number of types by using a space-
separated list of types.
If an invalid type is given, #-1 NO SUCH TYPE is returned.
& HIDDEN()
hidden(<player|descriptor>)
Returns 1 if the player is hidden, otherwise 0.
Can only be called by someone privileged to see hidden players.
If you're not, #-1 is returned.
& HOME()
home(<object>)
Returns the object's 'home'. This is the home for a player or thing,
the drop-to of a room, or source of an exit.
& HOST()
& HOSTNAME()
host(<player|descriptor>)
hostname(<player|descriptor>)
Returns the hostname of a player as indicated by WHO. This may
be more reliable that get(<player>/lastsite) if the player has
multple connections from different locations, and the function
is called with a descriptor argument.
The caller can use the function on himself, but using on any other
player requires privileged power such as Wizard, Royalty or SEE_ALL.
See also: Connection Functions, ipaddr(), ports(), lports()
& IDLE()
& IDLESECS()
idle(<player|descriptor>)
idlesecs(<player|descriptor>)
This function returns the number of seconds a player has been idle,
much as WHO does. <player name> must be the full name of a player, or
a player's dbref. Players who are not connected have an idlesecs of "-1",
as do dark wizards, when idle() is used on them by a non-priv'ed player.
& IF()
& IFELSE()
if(<condition>, <true expression>[, <false expression>])
ifelse(<condition>, <true expression>, <false expression>)
These functions evaluate the <condition> and return <true expression>
if the <condition> is true, or <false expression> (if provided) if the
<condition> is false.
See also: BOOLEAN VALUES, switch()
& INAME()
iname(<object>)
iname() returns the name of object <object>, as it would appear if
you were inside it. It is identical to name() except that if the
object has a NAMEFORMAT or NAMEACCENT attribute, it is used.
You must be see_all, control <object>, or be inside it to use this
function.
See also: @nameformat, name(), fullname()
& INC()
inc(<integer>)
inc(<string-ending-in-integer>)
Inc returns the integer plus 1. If given a string that ends in an integer,
it increments only the final integer portion. That is:
> think inc(3)
4
> think inc(hi3)
hi4
> think inc(1.3.3)
1.3.4
> think inc(1.3)
1.4
Note especially the last example, which will trip you up if you use
floating point numbers with inc() and expect it to work like add().
See also: dec()
& INDEX()
index(<list>,<character>, <first>, <length>)
This function is similar to EXTRACT(), except that it requires four
arguments, while EXTRACT() uses defaults for its arguments if they
aren't given. The function returns <length> items starting from
the <first> position. Trailing spaces are trimmed. The comma cannot
be used as the <character> separator unless it's escaped with a \.
Examples:
> say [index(Cup of Tea | Mug of Beer | Glass of Wine, |, 2, 1)]
You say, "Mug of Beer"
> say [index(%rtoy boat^%rblue tribble^%rcute doll^%rred ball,^,2,2)]
You say, "
blue tribble^
cute doll"
See also: extract(), elements(), grab()
& INSERT()
insert(<list>, <position>, <new item>[,<single-character separator>])
If <position> is a positive integer, this inserts <new item> BEFORE
the item at <position> from the left in <list>.
That means that <new item> then becomes the <position>th element of
<list>. If a separator is not given, a space is assumed. Null items are
counted when determining position, as in 'items()'.
If <position> is a negative integer, this inserts <new item> AFTER
the item at the absolute value of <position> from the RIGHT in <list>.
This is the same as reversing the list before inserting <new item>,
and then reversing it again into correct order. For example, when
<position> is -1, <new item> will be the last in the list; when
<position> is -2, <new item> will be the second item from the right,
and so on.
Examples:
> say [insert(This is a string,4,test)]
You say, "This is a test string"
> say [insert(one|three|four,2,two,|)]
You say, "one|two|three|four"
> say [insert(meep bleep gleep,-3,GOOP)]
You say, "meep GOOP bleep gleep"
& ISDAYLIGHT()
isdaylight()
Returns 1 if it's daylight savings time in the MUSH time zone,
otherwise 0.
& ISDBREF()
isdbref(<string>)
This function returns 1 if the string is a valid object dbref (or
object id), and 0 if the string is not a valid object dbref/objid.
See also: DBREFS, isobjid()
& ISINT()
isint(<string>)
Returns 1 if its argument is an integer, and 0 otherwise. Integers can
begin with a '+' or '-' sign, but the rest of the string must be digits.
See also: isnum()
& ISNUM()
isnum(<string>)
This function returns 1 if <string> is a number, and 0 if it is not.
Numbers can begin with a '-' sign (for negatives), but the rest of
the characters in the string must be digits, and an optional decimal
point.
See also: isint()
& ISOBJID()
isobjid(<string>)
This function returns 1 if the string is a valid object id, and
0 if the string is not a valid object id.
See also: DBREFS, isdbref(), objid()
& ISWORD()
isword(<string>)
This function returns 1 if every character in <string> is a letter,
or 0, if any character isn't a letter. Case does not matter.
& ITEMS()
items(<list>,<single-character separator>)
items() counts the number of items in a list using an arbitrary
(required) separator. Null items are counted, so:
items(X|X,|) => 2 (2 X items)
items(X||X,|) => 3 (2 X items and 1 null item)
items(X X,%b) => 2 (2 X items)
items(X%b%bX,%b) => 3 (2 X items and 1 null item)
items(,|) => 1 (a single null item)
Another way to think about this is that items() counts the number
of delimiters in the string, and adds 1.
& ITEMIZE()
& ELIST()
itemize(<list>[,<delim>[, <conjunction>[, <punctuation>]]])
elist(<list>[, <conjunction>[,<delim>[, <output delim>[, <punctuation>]]]])
These functions take the elements of <list> (separated by <delim> or
a space by default), and:
If there's just one, return it.
If there's two, return <e1> <conjunction> <e2>
If there's more than two, return <e1><punc> <e2><punc> ... <conj> <en>
The default <conjunction> is "and", default punctuation is ","
Examples:
> say [itemize(eggs)] * [itemize(eggs bacon)]
You say, "eggs * eggs and bacon"
> say [itemize(eggs bacon spam)]
You say, "eggs, bacon, and spam"
> say [itemize(eggs bacon spam, ,&,;)]
You say, "eggs; bacon; & spam"
& ITER()
& PARSE()
iter(<list>, <pattern>[,<delimiter>[, <output separator>]])
parse(<list>, <pattern>[,<delimiter>[, <output separator>]])
This works in a manner very similar to @map, except that it returns
a string directly. <list> is a space-separated list of words, and
<pattern> is what will be "mapped" onto each element of the list,
with the token "##" being replaced successively by the next word in
the list, and the token "#@" being replaced by the word's position
in the list (also see 'help itext()' and see 'help inum()'). The result
is concatenated and returned as a space separated list. This is similar
to @dolist, but the results are made into a list rather than executed.
The list may be <delimiter>-separated.
By default, the return list will be space-separated. However,
by including the output separator (which requires explicitly
including the delimiter), you can have it separated by any string.
Continued in HELP ITER2
& ITER2
parse() is a synonym for iter(). If you nest iters, ## and #@ refer
to the first iter(). See 'help ITEXT()' and 'help INUM()' for how to
retrieve their values for any nested iter. See 'help MAP()' for a
similar function.
Note that ## and #@ are replaced before evaluation, so the word will
be evaluated, which can be a problem when iter()ing on an untrusted
list. iter-with-itext or map() should be preferred to iter-with-##
whenever you're iterating over user-provided values.
> say [iter(This is a test string., [strlen(##)])]
You say, "4 2 1 4 7"
> say [iter(lnum(5), mul(add(##,##),2))]
You say, "0 4 8 12 16"
> say [iter(lexits(here), [name(##)] (owned by [name(owner(##))]))]
You say, "South (owned by Claudia) North (owned by Roy)"
> &STRLEN_FN me=[strlen(%0)]
> say [iter(This is a test string., [u(STRLEN_FN, ##)])]
You say, "4 2 1 4 7"
This example could be replaced by the use of map() like so:
> say [map(strlen_fun, This is a test string)]
> say [iter(lnum(3), ##, ,%r)]
You say, "0
1
2"
& ILEV()
& ITEXT()
& INUM()
& %i
ilev()
itext(<n>)
%i<n>
inum(<n>)
These functions, when called within an iter(), return the equivalent
of ## (itext) or #@ (inum), with reference to the nth more outermost
iter(), where n=0 refers to the current iter(), n=1 to an iter()
in which the current iter() is nested, etc. %iX is shorthand for itext(X)
(up to itext(9). ilev() returns the current nesting depth, or -1
if it is outside an iter(). Thus, itext(ilev()) will return the ##
of the outermost iter().
> say [iter(red blue green,iter(fish shoe, #@:##))]
You say, "1:red 1:red 2:blue 2:blue 3:green 3:green"
> say [iter(red blue green,iter(fish shoe, [inum(ilev())]:[itext(1)]))]
You say, "1:red 1:red 2:blue 2:blue 3:green 3:green"
> say [iter(red blue green,iter(fish shoe, [inum(0)]:[itext(0)]))]
You say, "1:fish 2:shoe 1:fish 2:shoe 1:fish 2:shoe"
> say [iter(red blue green,iter(fish shoe, %i1:%i0))]
You say, "red:fish red:shoe blue:fish blue:shoe green:fish green:shoe"
& IPADDR()
ipaddr(<player|descriptor>)
Returns the IP address of the connected player or descriptor. This
may be more reliable that get(<player>/lastip) if the player has
multple connections from different locations, and the function
is called with a descriptor argument.
The caller can use the function on himself, but using on any other
player requires privileged power such as Wizard, Royalty or SEE_ALL.
See also: Connection Functions, hostname(), ports(), lports()
& LAST()
last(<list>[,<delimiter>])
Returns the last element of a list.
See also: first(), rest()
& LATTR()
& LATTRP()
lattr(<object>[/<attribute pattern>][, <delim>])
lattrp(<object>[/<attribute pattern>][, <delim>])
Returns a delim-separated list of the attribute names on the object
that you are permitted to examine. To see the complete list,
you must either be a Wizard or Royalty, own the object, have the
See_All power, or have the object set VISUAL in order to use this
function on the object. The delimiter defaults to space if not
given.
If a wildcarded attribute pattern is provided, only attribute names
matching that pattern will be returned. lattr() uses the same
wildcards as examine (?, *, **).
lattrp() also includes attributes inherited from parents.
See also: nattr(), examine
& NATTR()
& NATTRP()
& ATTRCNT()
& ATTRPCNT()
nattr(<object>[/<attribute-pattern>])
nattrp(<object>[/<attribute-pattern>])
attrcnt(<object>[/<attribute-pattern>])
attrpcnt(<object>[/<attribute-pattern>])
This function (known by two names) returns the number of attributes
on the object that you are permitted to examine. This function is
considerably faster than words(lattr()) and doesn't suffer from buffer
length constraints. It's designed primarily for statistical purposes.
nattrp() and attrpcnt() also count matching attributes on the parent.
See also: lattr()
& LCON()
lcon(<object>)
Returns a list of the dbrefs of contents in a container.
You can get the complete contents of any container you may examine,
regardless of whether or not objects are dark. You can get the
partial contents (obeying DARK/LIGHT/etc.) of your current location
or the enactor (%#). You CANNOT get the contents of anything else,
regardless of whether or not you have objects in it.
See also: lexits(), lplayers(), con(), next(), lvcon()
& LCSTR()
lcstr(<string>)
Returns <string> with all letters converted to lowercase.
Example: lcstr(Foo BAR bAz) returns "foo bar baz"
See also: capstr(), ucstr()
& LDELETE()
Ldelete(<list>, <position>[,<single-character separator>])
This deletes the item at <position> in the list. If a separator
character is not given, a space is assumed. Null items are
counted, as in 'items()'.
Examples:
> say [ldelete(This is a long test string,4)]
You say, "This is a test string"
> say [ldelete(lemon|orange|apple,2,|)]
You say, "lemon|apple"
& LEFT()
left(<string>, <length>)
Returns the first <length> characters from string.
See also: left(), mid()
& NSLEMIT()
& LEMIT()
lemit(<message>)
nslemit(<message>)
Sends a message to the outermost room, as per @lemit.
nslemit() is a wizard-only variation that works like @nslemit.
& LETQ()
letq([<reg1>, <value1>,...<regN>, <valueN>], <expr>))
letq() saves the current values of the given q-registers, sets them
to new values, evaluates <expr> and then restores the saved registers.
It does not restore registers that are not listed. None of the values
can see the updated contents of the registers -- they are only visible
to <expr>.
Example:
> think [setr(A, 1)]:[letq(A, 2, %qA)]:%qA
1:2:1
See also: setq(), setr(), localize(), ulocal()
& LEXITS()
lexits(<object>)
Returns a list of the dbrefs of exits in a room.
You can get the complete exit list of any room you may examine,
regardless of whether or not exits are dark. You can get the partial
exit list (obeying DARK/LIGHT/etc.) of your current location or the
enactor (%#). You CANNOT get the exit list of anything else,
regardless of whether or not you have objects in it.
See also: lcon(), exit(), next(), lvexits()
& LJUST()
ljust(<string>, <length>[,<fill>])
This function pads a string with trailing characters ("left-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:
> say [ljust(foo,6)]
You say, "foo "
> say %r0[ljust(foo,6,-)]7%r01234567
You say, "
0foo---7
01234567"
See also: align(), center(), rjust()
& LINK()
link(<name>, <destination>[, <preserve>])
This function links object <name> to <destination>. While normally
used on exits, it has all of the other capabilities of @link as well.
It returns nothing. If the optional third argument is true, acts like
@link/preserve.
This is a side-effect function and may not be enabled on some MUSHes.
& LIST()
list(<option>)
This function takes the same arguments as the @list command, and returns
the same things.
& LIT()
lit(<string>)
This function returns the string literally - without even squishing
spaces, and without evaluating *anything*. This can be useful for
writing ASCII maps with spaces or whatever.
It can be a bit tricky to get a literal string with spaces into an
attrib, however, since spaces are usually squished in setting an
attribute. This example illustrates how to make it work:
> @va me=$test: think {[lit(near far)]}
Set.
> ex me/va
VA [#1]: $test: think {[lit(near far)]}
> test
near far
Leaving out the {}'s will not work in the above.
& LMATH()
lmath(<op>, <list>[,<delim>])
This function performs generic math operations on <list>, returning
the result. Each element of the list is treated as one argument to
an operation, so that lmath(<op>, 1 2 3) is equivalent to <op>(1, 2, 3).
Using @function, one can easily write ladd, lsub, etc as per TinyMUSH.
Supported <op>'s are: add and band bor bxor div fdiv max mean
median min modulo mul nand nor or remainder stddev sub xor
Examples:
>think lmath(add, 1|2|3, |)
6
>think lmath(max, 1 2 3)
3
>&FUN_FACTORIAL me=[lmath(mul,lnum(1,%0))]
>think u(fun_factorial,5)
120
& LN()
ln(<number>)
Returns the natural log of <number>.
& LNUM()
lnum(<number>)
lnum(<start number>, <end number>[, <output separator>])
With one argument, lnum returns a list of numbers, from 0 to <number - 1>.
For example, lnum(4) returns the list "0 1 2 3". This is useful for
creating loops.
With two arguments, the numbers range from the first to the second
argument. For example, lnum(1,4) => 1 2 3 4
With three arguments, the output is separated by the separator
given in the third argument. lnum(1,4,|) => 1|2|3|4
& LOC()
loc(<object>)
Loc returns the dbref of the location that object is at. The
object has to either be yours or be in the same room as you to
work. The location of an exit is its destination (the source of
an exit is its home). The location of a room is its drop-to
(if one is not set, then the location is #-1).
& LOCALIZE()
localize(<code>)
Localize() saves the q-registers, evaluates its argument, and restores
the registers afterwards. It has much the same relation to s() that
ulocal() does to u(), except localize()'s argument is only evaluated
once, instead of twice like s()'s. Useful in @functions or to wrap around
fragments of code too small to go into another attribute.
Example:
> say [setr(0, Outside)]-[s(\[setr(0, Inside)\])]-%q0
You say, "Outside-Inside-Inside"
> say [setr(0, Outside)]-[localize(setr(0, Inside))]-%q0
You say, "Outside-Inside-Outside"
See also: letq(), setq(), setr(), r(), ulocal(), uldefault(), s()
& LOCATE()
locate(<looker>, <name>, <parameters>)
This function attempts to find the number called <name> relative to
<looker>. You must control <looker> or have the See_All power.
This is a bit like the NUM() function, but with a wider, controllable
"range".
You can control the preferred type of the match with:
E - Exits
L - Unlocked exits preferred over locked exits
N - No type (this is the default)
P - Players
R - Rooms
T - Things
F - Return #-1 if what's found is of a different type than the
preferred one.
X - Never return #-2. Use the last dbref found if the match is
ambiguous.
If you specify more than one type, any will be preferred. Unless
you specify an F option, if an object of a different type is found and
none of the preferred type are, the found object will be returned.
(Read "help locate2" for more.)
& LOCATE2
You can control where to look with:
a - Absolute match (look for #<object>)
c - Exits carried by <looker>
e - Exits in <looker>'s location
h - "here" (the location of <looker>)
i - Inventory of <looker>
l - Location (container) of <looker>
m - "me" (<looker> itself)
n - Neighbors (other objects in same location as <looker>)
p - Player names prefixed by '*'
y - Player names with or without a '*' prefix
z - English-style matching (my 2nd book) of <name>
* - All of the above (try a complete match)
Just string all the parameters together, without separating them by
spaces, i.e. LOCATE(#100, Test, Tn) would check #100's neighbors
for an object named "Test", preferring a thing over other types.
& LOCK()
lock(<object>[/<locktype>][, <new value>])
lock() returns the text string equivalent of the lock on an object that
you control. You can also provide a locktype (e.g. "enter", "use", etc.)
switch after the object, if you want to check something other than the
regular lock. If a new value is specified, it will attempt to change
the lock before reporting it.
This is a side-effect function and may not be enabled on some MUSHes.
See also: @lock, locktypes, elock(), lockflags(), llockflags(), lset(),
llocks()
& LLOCKS()
& LOCKS()
llocks(<object>)
locks(<object>)
llocks(), aliased locks(), list locks set on <object>, including
user-defined locks (prefixed with USER:)
> @lock me==me
> @lock/use me==me
> @lock/user:itsme me==me
> th llocks(me)
Basic USER:ITSME Use
See also: lock(), lset(), lockflags(), llockflags()
& LOCKFLAGS()
lockflags(<object>[/<locktype>])
lockflags()
lockflags() returns a string consisting of the flags attached to
the specified lock on the object. The string is a single word
made up of all the appropriate flag letters.
Given no arguments, this function returns a string consisting of
all the flag letters the server knows.
See also: llockflags(), lset(), lock(), llocks()
& LLOCKFLAGS()
llockflags(<object>[/<locktype>])
llockflags()
llockflags returns a space-separated list consisting of the names
of flags attached to the specified lock on the object.
Given no arguments, this function returns a space-separated list
of all flag names known to the server.
See also: lockflags(), lset(), lock(), llocks()
& LSET()
lset(<object>/<lock type>,[!]<flag>)
This functions sets or clears flags on locks.
See 'help @lset' for more information on what flags are available.
& LOG()
log(<number>[, <base>])
Returns the logarithm (base 10, or the given base) of <number>.
& LPARENT()
lparent(<object>)
This function returns a list consisting of the object's db# (as per
num()), the db# of its parent, grandparent, greatgrandparent, etc.
The list will not, however, show parents of objects which the player
is not privileged to examine.
& LPLAYERS()
lplayers(<object>)
This function returns the dbrefs of all players, connected or not, in
<object>. DARK wizards aren't listed to mortals or those without the
see_all power. You must be in <object> or control it to use this
function.
See also: lvplayers(), lcon(), lthings()
& LTHINGS()
lthings(<object>)
This function returns the dbrefs of all things, dark or not, in
<object>. You must be in <object> or control it to use this function.
See also: lvthings(), lcon()
& LPOS()
lpos(<string>, <character>)
This function returns a list of the positions where <character> occupies
in <string>, with the first character of the string being 0. Note that
this differs from the pos() function, but is consistent with other string
functions like mid() and delete().
If <character> is a null argument, space is used.
If <character> is not found anywhere in <string>, an empty list is
returned.
Example:
> say lpos(a-bc-def-g, -)
You say, "1 4 8"
See also: pos()
& LSEARCH()
& NLSEARCH()
& SEARCH()
& NSEARCH()
& LSEARCHR()
& CHILDREN()
& NCHILDREN()
lsearch(<player>[, ... , <classN>, <restrictionN>])
nlsearch(<player>[, ... , <classN>, <restrictionN>])
lsearchr(<player>[, ... , <classN>, <restrictionN>])
children(<object>)
nchildren(<object>)
This function is similar to the @search command, except it returns
just a list of dbref numbers. It is computationally expensive, and
costs 100 pennies to perform. The function must have at least three
arguments. Wizards can specify "all" or <player> for the <player>
field; mortals must use "me". If you do not want to restrict
something, use "none" for <class> and/or <restriction>.
The possible <class>es and <restriction>s are the same as those accepted
by @search. lsearch() can accept multiple class/restriction pairs, and
applies them in a boolean "AND" fashion, returning only dbrefs that
fulfill all restrictions. See 'help @search' for information about them.
children() is exactly the same as lsearch(<me|all>,parent,<object>),
using "all" for See_All/Search_All players and "me" for others.
nlsearch(...) and nchildren(...) return the count of results that
would be returned by lsearch() or children() with the same args.
See 'help lsearch2' for more details.
& LSEARCH2
& SEARCH2
If <class> is one of the eval ones (EVAL, EEXITS, EROOMS, EOBJECTS or
EPLAYERS), note that any brackets, percent signs, or other special
characters should be escaped, as the code in <restriction> will be
evaluated twice - Once as an argument to lsearch(), and then again for
each object looked at in the search.
<class> can be 'NONE' to make lsearch() act like a @search without a class.
lsearchr() is like an lsearch() run through revwords(). Results are returned
from highest dbref to lowest.
search() is an alias for lsearch().
Examples:
lsearch(all, flags, Wc) <-- lists all connected wizards.
lsearch(me, type, room) <-- lists all rooms owned by me.
lsearch(me, type, room, flag, W) <-- lists Wizard rooms owned by me.
lsearch(me, type, room, 100, 200) <-- same, but only w/db# 100-200
lsearch(all, eplayer, \[eq(money(##),100)\]) <-- lists all players with 100
coins.
& LSTATS()
& STATS()
lstats(<player>)
stats(<player>)
This function returns the breakdown of objects in the database, in
a format similar to "@stats". If <player> is "all", a breakdown is
done for the entire database. Otherwise, the breakdown is returned
for that particular player. Only wizards can LSTATS() other players.
The list returned is in the format:
<Total objects> <Rooms> <Exits> <Things> <Players> <Garbage>
stats() is an alias for lstats().
& LT()
lt(<num>, <num>)
Takes two numbers, and returns 1 if and only if the first is less
than the second, and 0 otherwise.
& LTE()
lte(<num>, <num>)
Takes two numbers, and returns 1 if and only if the first is less
than or equal to the second, and 0 otherwise.
& LVCON()
lvcon(<object>)
This function returns the dbrefs of all objects that are inside <object>
and visible (non-dark). You must be in <object> or control it to use this
function.
See also: lcon()
& LVEXITS()
lvexits(<room>)
This function returns the dbrefs of all visible (non-dark) exits from
<room>. You must be in the room or control it to use this function.
See also: lexits()
& LVPLAYERS()
lvplayers(<object>)
This function returns the dbrefs of all connected and non-dark players
in an object. You must be in the object or control it to use this
function.
& LVTHINGS()
lvthings(<object>)
This function returns the dbrefs of all non-dark things inside an
object. You must be in the object or control it to use this function.
& LWHO()
& LWHOID()
lwho()
lwho(<viewer>)
lwhoid(<viewer>)
lwho() returns a list of the dbref numbers for all currently-connected
players. When mortals use this function, the dbref numbers of DARK
wizards or royalty do NOT appear on the dbref list.
If lwho() is given an argument, and used by an object that can see
DARK and Hidden players, lwho() returns the output of lwho() from
<viewer>'s point of view.
lwohid() returns a list of objid's instead.
See also: mwho(), nwho(), xwho()
& MAP()
map([<object>/]<attribute>, <list>[,<delim>[, <osep>]])
Maps a function onto a list.
This function works much like ITER(). Each element of <list> has
the user-defined function of the first argument performed on it;
the element is passed to the function as %0, and its position
in <list> as %1. <delim> is used as the element delimiter;
if it is not specified, a space is used. The resulting output is
delimited by <osep>, if given, or else by the delimiter
Examples:
> ×_two me=[mul(%0,2)]
> say [map(times_two, 5 4 3 2 1)]
You say, "10 8 6 4 2"
> say [map(times_two,1;2;3;4;5,;)]
You say, "2;4;6;8;10"
See also: anonymous attributes
& MATCH()
match(<list>, <pattern>[,<delimiter>])
This function tests if the pattern matches an element of the list.
The pattern can contain the wildcards * and ?. ? matches to any
one character, while * matches to any number of characters
including none. So s?x would match to sex or six, but not to socx,
but s*x would match to all of them. If no match is found, 0 is
returned. If a match is found, it returns the number of the element
of the list that matched.
This attempts to match to a list element, not to an entire string.
To match an entire string (for example, to match "red blue green"
to "*bl*"), use the strmatch() function.
See also: element(), grab()
& MATCHALL()
matchall(<list>, <pattern>[,<delim>[, <osep>]])
This function works identically to the match() function, save that it
returns all matches, not just the first: It returns the index numbers of
all elements in <list> which match <pattern>. If none match, an empty
string is returned. The resulting output is delimited by <osep>, if
given, or else by the delimiter.
Examples:
> say matchall(This is a test of a test,test)
You say "4 7"
> say matchall(This is testing a test,tes*)
You say "3 5"
See also: match(), strmatch(), graball()
& MAX()
max(<number>[, ... , <numberN>])
This function returns the largest number in its list of arguments.
It can take any number of arguments.
& MEAN()
mean(<number>[, ... , <numberN>])
Returns the mean (arithmetic average) of its arguments.
See also: median(), stddev()
& MEDIAN()
median(<number>[, ... , <numberN>)
Returns the median (the middlemost numerically) of its arguments.
See also: mean(), stddev()
& MEMBER()
member(<list>, <word>[,<delimiter>])
Takes a list and a word, and returns the position of <word>
if <word> is a word in <list>. A word is defined as a string which
has no interior spaces. So ' hello ' would be one word, while
'hello there' would be two. See 'LISTS'
member() is case-sensitive and requires an exact match. For wild
card patterns, use match().
& MERGE()
merge(<string1>, <string2>, <characters>)
This function merges <string1> and <string2>, depending on <characters>.
If a character in <string1> is the same as one in <characters>, it is
replaced by the character in the corresponding position in <string2>. The
two strings must be of the same length.
Example:
> say [merge(AB--EF,abcdef,-)]
You say, "ABcdEF"
Spaces need to be treated specially. An empty argument is considered to
equal a space, for <characters>.
Example:
> say [merge(AB[space(2)]EF,abcdef,)]
You say, "ABcdEF"
See also: splice(), tr()
& MID()
mid(<string>, <first>, <length>)
Mid returns a segment of the string, the <length> characters to the
right of the <first> character. Note that the first character in a
string is numbered zero, and not one. If <length> is negative, it
returns characters to the left of the <first> character. The <first>
character is always part of the <length> characters.
Examples:
> say mid(foobar, 2, 2)
You say, "ob"
> say mid(foobar, 2, -2)
You say, "oo"
See also: left(), right()
& MIN()
min(<number>[, ... , <numberN>])
This function returns the smallest number in its list of arguments.
It can take any number of arguments.
& MIX()
mix([<object>/]<attribute>, <list 1>, <list 2>[, ... , <list n>,<delim>])
This function is similar to MAP(), except that it takes the elements
of two or more lists, one by one, and passes them to the user-defined
function as %0, %1, up to %9, respectively, for elements of <list 1> to
<list 10>. If the lists are of different sizes, the shorter ones are padded
with empty elements. <delim> is used to separate elements; if it is not
specified, it defaults to a space. If using more than 2 lists, the last
argument must be a delimiter.
See 'MIX2' for examples
& MIX2
Examples of mix():
> &add_nums me=[add(%0, %1)]
> say [mix(add_nums,1 2 3 4 5, 2 4 6 8 10)]
You say, "3 6 9 12 15"
> &lengths me=[strlen(%0)] and [strlen(%1)].
> say [mix(lengths, some random, words)]
You say, "4 and 5. 6 and 0."
> &add_nums me=[add(%0, %1, %2)]
> say [mix(add_nums, 1:1:1, 2:2:2, 3:3:3, :)]
You say, "6:6:6"
See also: anonymous attributes
& MOD()
& MODULO()
& MODULUS()
& REMAINDER()
mod(<number>, <number>)
modulo(<number>, <number>)
modulus(<number>, <number>)
remainder(<number>, <number>)
Remainder returns the remainder of the integer division of the first
number by the second. Modulo returns the modulo of the two numbers.
For positive numbers, these are the same, but they may be different
for negative numbers:
modulo(13,4) ==> 1 and remainder(13,4) ==> 1
modulo(-13,4) ==> 3 but remainder(-13,4) ==> -1
modulo(13,-4) ==> -3 but remainder(13,-4) ==> 1
modulo(-13,-4) ==> -1 and remainder(-13,-4) ==> -1
Remainder result always has the same sign as the first argument.
Modulo result always has the same sign as the second argument.
Mod and modulus are just aliases for modulo.
See also: div()
& MONEY()
money(<object>)
money(<integer>)
The first form returns the amount of money <object> has.
The second form returns the name for a given amount
of money, appropriately inflected as singular or plural.
> say [money(Javelin)]
You say, "150"
> say [money(1)]
You say, "Penny"
> say [money(2)]
You say, "Pennies"
> &counter me=$count *: @emit %0 [money(%0)]
> count 2
2 Pennies
& MTIME()
& MSECS()
mtime(<object>[, <utc>])
msecs(<object>)
If creation times are enabled, this function will return the
date and time that one of the object's attributes was last
added, deleted, or modified. Only things, rooms, and exits have
modification times. If the optional <utc> argument is true, the
time is returned for the UTC time zone, if false or present, for
the local time zone.
msecs() returns the time as the number of seconds since the epoch.
You must be able to examine an object to see it's modification time.
See also: ctime()
& MUDNAME()
mudname()
Returns the name of the MUD. This is usually (but not necessarily) the name
that appears in the various mud lists, and is the name that the mud is
listed under in reports from any inter-mush bots like mudnet that it's
connected to.
Example:
> say mudname()
You say "TestMUSH"
& MUL()
mul(<number>, <number>[, ... , <numberN>])
Returns the product of some numbers.
& MUNGE()
munge([<object>/]<attribute>, <list 1>, <list 2>[,<delimiter>[, <osep>]])
This function takes two lists of equal length. It passes the entirety of
<list 1> to the user-defined function as %0, and the delimiter as %1.
Then, this resulting list is matched with elements in <list 2>, and
the rearranged <list 2> is returned. This is useful for doing things
like sorting a list, and then returning the corresponding elements in
the other list. If a resulting element from the user-defined function
doesn't match an element in the original <list 1>, a corresponding
element from <list 2> does not appear in the final result.
See 'MUNGE2' for examples.
& MUNGE2
For example: Consider attribute PLACES, which contains "Fort Benden Ista",
and another attribute DBREFS contains the dbrefs of the main JUMP_OK
location of these areas, "#20 #9000 #5000". We want to return a list of
dbrefs, corresponding to the names of the places sorted alphabetically. The
places sorted this way would be "Benden Fort Ista", so we want the final
list to be "#9000 #20 #5000". The functions, using munge(), are simple:
> &sort me=[sort(%0)]
> say [munge(sort,v(places),v(dbrefs))]
You say, "#9000 #20 #5000"
See 'MUNGE3' for another example.
& MUNGE3
Another common task that munge() is well suited for is sorting a list
of dbrefs of players by order of connection. This example reuses the
&sort attribute from the previous one, but unlike the other example,
it builds the list to sort on out of the list to return.
> &faction_members me=#3 #12 #234
> say [munge(sort,iter(v(faction_members),conn(##)),v(faction_members))]
You say, "#12 #234 #3"
See also: anonymous attributes
& MWHO()
& MWHOID()
mwho()
mwhoid()
mwho() returns a list of the dbref numbers for all current-connected,
non-hidden players. It's exactly the same as lwho() used by a
mortal, and is suitable for use on privileged global objects who
need an unprivileged who-list.
mwhoid() returns a list of objids instead.
& ALIAS()
alias(<player>[, <new alias>])
Alias returns the alias of <player>. If multiple aliases are set,
alias returns the first component of the alias.
If function side effects are allowed, this function, given two arguments,
acts just like @alias <object>=<new alias>.
Related functions: FULLALIAS()
& FULLALIAS()
fullalias(<player>)
fullalias() returns the alias of <player>. It is identical to
alias() except when multiple aliases are set, fullalias() returns the
complete alias list.
>"[fullalias(Noltar)]
You say, "$;No;Nol;Noli;Nolt"
Related functions: ALIAS()
& NAME()
name(<object>[, <new name>])
Name returns the name of object <object>. For exits, name returns
the displayed name of the exit.
If function side effects are allowed, this function, given two arguments,
acts just like @name <object>=<new name>.
name() with no arguments currently returns nothing. This should be an
error, but enough old code has been written that expects this behavior
that it will continue to do this for the time being. Don't rely on it.
Related functions: FULLNAME(), ACCNAME(), INAME()
& NAMELIST()
namelist(<player-list>)
Namelist takes a list of players of the form used by the page
command and returns a corresponding list of dbrefs.
>"[namelist(#1 Javelin "ringo spar" bogus)]
You say, "#1 #7 #56 #-1"
& NAMEGRAB()
& NAMEGRABALL()
namegrab(<dbref list>, <name>)
namegraball(<dbref list>, <name>)
The namegrab() function, when given a list of dbrefs and a name, returns
the first dbref in the list that would match <name> as if you were
checking num() or locate(). An exact match has priority over non-exact matches.
namegraball() returns all dbrefs whose names would be matched by<name>.
eg: @@(#0: Room Zero. #1: One. #2: Master Room)
> th namegrab(#0 #1 #2,room)
#0
> th namegrab(#0 #1 #2,master room)
#2
> th namegraball(#0 #1 #2,room)
#0 #2
& NAND()
nand(<boolean>[, ... , <booleanN>])
Returns 1 if at least one of its arguments is false, 0 if all are
true. Equivalent to not(and()), but more efficient.
& NEARBY()
nearby(<object 1>, <object 2>)
Returns 1 if object 1 is "nearby" object 2. "Nearby" is defined as:
object 1 is in the same location as object 2, or,
object 1 is being carried by object 2, or,
object 1 is carrying object 2.
You must control at least one of the objects.
& NEQ()
neq(<num1>, <num2>)
Basically the same as [not(eq(<num1>,<num2>))].
See also: eq(), not()
& NEXT()
next(<object>)
If object is an exit in a room, then next() will return the next
non exit in the list of exits for that room. If object is a
thing or a player, then next will return the next object in the
contents list that the object is in. Otherwise, it returns a
'#-1' string. '#-1' is also used to denote that there are no
more exits/things/players in the container.
You can get the complete contents of any container you may examine,
regardless of whether or not objects are dark. You can get the
partial contents (obeying DARK/LIGHT/etc.) of your current location
or the enactor (%#). You CANNOT get the contents of anything else,
regardless of whether or not you have objects in it. These rules
apply to exits, as well.
See also: lcon(), lexits(), con(), exit()
& NEXTDBREF()
nextdbref()
This function returns the next dbref on the free list; when the next
object is @created (or @dug, or @opened, or @pcreated, etc.), it
will have this dbref.
& NMWHO()
nmwho()
This returns a count of all currently connected, non-hidden players.
It's exactly the same as nwho() used by a mortal, and is suitable
for use on privileged global objects who need an unprivileged count
of who's online.
See also: nwho(), mwho(), xmwho()
& NOR()
nor(<boolean>[, ... , <booleanN>])
Returns 1 if all its arguments are false, 0 if one is true.
Equivalent to not(or()), but more efficient.
See also: and(), or(), xor(), not()
& NOT()
not(<boolean value>)
Takes a boolean value, and returns its inverse.
I.E. if the input is equivalent to true(1), it returns a 0, and if
the input is equivalent to false(0), it returns a 1.
The definition of truth and falsehood depends on configuration settings;
see 'BOOLEAN VALUES' for details.
See also: and(), or(), nor(), xor()
& NUM()
num(<object>)
Returns the dbref number of the object, which must be in the same
room as the object executing num.
& NVCON()
& NCON()
ncon(<object>)
nvcon(<object>)
These functions return a count of the contents in a container.
ncon(<object>) is identical to words(lcon(<object>))
nvcon(<object>) is identical to words(lvcon(<object>))
See also: nexits(), nplayers(), xcon(), lcon(), lvcon()
& NVEXITS()
& NEXITS()
nexits(<room>)
nvexits(<room>)
These functions return a count of the exits in a room.
nexits(<room>) is identical to words(lexits(<room>))
nvexits(<room>) is identical to words(lvexits(<room>))
See also: ncon(), nplayers(), xexits(), lexits(), lvexits()
& NVPLAYERS()
& NPLAYERS()
nplayers(<object>)
nvplayers(<object>)
These functions return a count of the players in a container.
nplayers(<object>) is identical to words(lplayers(<object>))
nvplayers(<object>) is identical to words(lvplayers(<object>))
See also: ncon(), nexits(), xplayers(), lplayers(), lvplayers()
& NVTHINGS()
& NTHINGS()
nthings(<object>)
nvthings(<object>)
These functions return a count of the things in a container.
nthings(<object>) is identical to words(lthings(<object>))
nvthings(<object>) is identical to words(lvthings(<object>))
See also: ncon(), nexits(), xthings(), lthings(), lvthings()
& NWHO()
nwho()
This returns a count of all currently-connected players. When
mortals use this function, DARK wizards or royalty are NOT counted.
See also: lwho(), nmwho(), xwho()
& OBJ()
obj(<object>)
Returns the objective pronoun - him/her/it - for an object.
& OBJEVAL()
objeval(<object>, <expression>)
Allows you to evaluate <expression> from the viewpoint of <object>.
If side-effect functions are enabled, you must control <object>;
if not, you must either control <object> or have the see_all power.
If <object> does not exist or you don't meet one
of the criterion, the function evaluates with your privileges.
This function is useful for securing objects which need to evaluate
attributes on things owned by others.
& OBJID()
objid(<object>)
This function returns the object id, a value which uniquely identifies
it for the life of the MUSH. The object id is the object's dbref,
a colon character, and the object's creation time, in seconds since
the epoch.
The object id can be used nearly anywhere the dbref can, and ensures
that if an object's dbref is recycled, the new object won't be mistaken
for the old object.
The substitution %: returns the object id of the enacting object.
& OBJMEM()
objmem(<object>)
This function returns the amount of memory, in bytes, being used
by the object. It can only be used by players with Search powers.
See also: playermem()
& OEMIT()
& NSOEMIT()
oemit([<room>/]<object> [... <object>], <message>)
nsoemit([<room>/]<object> [... <object>], <message>)
Sends <message> to all objects in <room> (default is the location
of <object>(s)) except <object>(s), as per @oemit.
nsoemit() is a wizard-only variation that works like @nsoemit.
& OPEN()
open(<exit name>, <room>)
This function opens an exit called <exit name> and links it to
<room>, which must be a dbref number. It returns the dbref number
of the new exit.
& OR()
& COR()
or(<boolean value 1>, <boolean value 2>[, ... , <boolean value N>])
cor(<boolean value 1>, <boolean value 2>[, ... , <boolean value N>])
Takes boolean values, and returns a 1 if at least one of the inputs
is equivalent to true(1). or() always evaluates all arguments
(including side effects), while cor() stops evaluation after the
first argument that evaluates to true.
See also: BOOLEAN VALUES, and()
& ORFLAGS()
orflags(<object>,<string of flag characters>)
This function returns 1 if <object> has at least one of the flags in
a specified string, and 0 if it does not. The string is specified with
a single letter standing for each flag, like the output of the FLAGS()
function. A '!' preceding a flag letter means "not flag".
Thus, ORFLAGS(me,Wr) would return 1 if I am set WIZARD or ROYALTY.
ORFLAGS(me,D!c) would return 1 if I am DARK or not CONNECTED.
If a letter does not correspond to any flag, <object> doesn't have it,
so it is simply ignored. There can be an arbitrary number of flags. Do
not put spaces between flag letters.
& ORLFLAGS()
orlflags(<object>, <list of flag names>)
This function returns 1 if <object> has at least one of the flags in
a specified list, and 0 if it does not. The list is a space-separated
list of flag names. A '!' preceding a flag nameShowing the first 100 KB of 172.7 KB. Download the archive for the full file.