| 1 |
& FUNCTIONS |
|---|
| 2 |
Functions are specialized commands used to manipulate strings and |
|---|
| 3 |
other input. Function take the general form: [FUNCTION(<input>)] |
|---|
| 4 |
|
|---|
| 5 |
The brackets are used to delimit and force evaluation of the function |
|---|
| 6 |
(or nested functions). The brackets can also be used to group functions |
|---|
| 7 |
for the purposes of string concatenation. In general, more than one pair |
|---|
| 8 |
of brackets is not required, but you can nest an arbitrary number of |
|---|
| 9 |
brackets. |
|---|
| 10 |
|
|---|
| 11 |
Examples: |
|---|
| 12 |
> say [first(rest(This is a nice day))] |
|---|
| 13 |
You say, "is" |
|---|
| 14 |
> @va me=This is a |
|---|
| 15 |
Wizard - Set. |
|---|
| 16 |
> @vb me=nice day |
|---|
| 17 |
Wizard - Set. |
|---|
| 18 |
> say [first([rest([v(va)] [v(vb)])])] |
|---|
| 19 |
You say, "is" |
|---|
| 20 |
|
|---|
| 21 |
See "help FUNCTIONS2" for more. |
|---|
| 22 |
|
|---|
| 23 |
& FUNCTIONS2 |
|---|
| 24 |
|
|---|
| 25 |
A list of available built-in functions can be obtained via the command |
|---|
| 26 |
"@config/functions". In the help text, the list is under the topic |
|---|
| 27 |
"FUNCTION LIST". |
|---|
| 28 |
|
|---|
| 29 |
In addition to these built-in functions are MUSH-defined "global user |
|---|
| 30 |
functions." These are defined by wizards or those with the "Function" |
|---|
| 31 |
power, via the "@function" command. To the user, they act just like |
|---|
| 32 |
the built-in game functions. For details on global user functions, |
|---|
| 33 |
see "help @function". |
|---|
| 34 |
|
|---|
| 35 |
See also: MUSHCODE |
|---|
| 36 |
& FUNCTION LIST |
|---|
| 37 |
Several major variants of functions are available. The help topics |
|---|
| 38 |
are listed below, together with a quick summary of the function type |
|---|
| 39 |
and some examples of that type of function. |
|---|
| 40 |
|
|---|
| 41 |
Attribute functions: attribute-related manipulations (GET, UFUN) |
|---|
| 42 |
Bitwise functions: Manipulation of individual bits of numbers (SHL, BOR) |
|---|
| 43 |
Boolean functions: produce 0 or 1 (false or true) answers (OR, AND) |
|---|
| 44 |
Channel functions: Get information about channels (CTITLE, CWHO) |
|---|
| 45 |
Communication functions: Send messages to objects (PEMIT, OEMIT) |
|---|
| 46 |
Connection functions: Get information about a player's connection (CONN) |
|---|
| 47 |
Dbref functions: return dbref info related to objects (LOC, LEXITS) |
|---|
| 48 |
Html functions: output html tags for Pueblo-compatible clients |
|---|
| 49 |
Information functions: find out something about objects (FLAGS, MONEY) |
|---|
| 50 |
List functions: manipulate lists (REVWORDS, FIRST) |
|---|
| 51 |
Mail functions: manipulate @mail (MAIL, FOLDERSTATS) |
|---|
| 52 |
Math functions: number manipulation, generic or integers only (ADD, DIV) |
|---|
| 53 |
Regular expression functions: Regular expressions (REGMATCH, REGEDIT) |
|---|
| 54 |
SQL functions: Access SQL databases (SQL, SQLESCAPE) |
|---|
| 55 |
String functions: string manipulation (ESCAPE, FLIP) |
|---|
| 56 |
Time functions: Formatting and display of time (TIME, CONVSECS) |
|---|
| 57 |
Utility functions: general utilities (ISINT, COMP) |
|---|
| 58 |
|
|---|
| 59 |
The command "@config/functions" lists all of the game's built-in functions. |
|---|
| 60 |
The command "@function" lists all of the game's custom global functions |
|---|
| 61 |
defined via the @function command. |
|---|
| 62 |
|
|---|
| 63 |
& Attribute functions |
|---|
| 64 |
The primary purpose of these functions is to access information |
|---|
| 65 |
stored in attributes on objects. |
|---|
| 66 |
|
|---|
| 67 |
aposs() attrib_set() default() edefault() eval() |
|---|
| 68 |
get() grep() grepi() lattr() nattr() |
|---|
| 69 |
obj() poss() regrep() regrepi() subj() |
|---|
| 70 |
udefault() ufun() uldefault() ulocal() v-function |
|---|
| 71 |
wildgrep() wildgrepi() xget() zfun() |
|---|
| 72 |
|
|---|
| 73 |
See also: ATTRIBUTES, NON-STANDARD ATTRIBUTES |
|---|
| 74 |
& Bitwise functions |
|---|
| 75 |
These functions treat integers as a sequence of binary bits (Either 0 |
|---|
| 76 |
or 1) and manipulate them. |
|---|
| 77 |
|
|---|
| 78 |
For example, 2 is represented as '0010' and 4 as '0100'. If these two |
|---|
| 79 |
numbers are bitwise-or'ed together with BOR(), the result is 6, or |
|---|
| 80 |
(In binary) '0110'. These functions are useful for storing small |
|---|
| 81 |
lists of toggle (Yes/No) options efficiently. |
|---|
| 82 |
|
|---|
| 83 |
baseconv() band() bnand() bnot() bor() |
|---|
| 84 |
bxor() shl() shr() |
|---|
| 85 |
|
|---|
| 86 |
& Boolean functions |
|---|
| 87 |
Boolean functions all return 0 or 1 as an answer. |
|---|
| 88 |
Your MUSH may be configured to use traditional PennMUSH booleans, |
|---|
| 89 |
in which case non-zero numbers, non-negative db#'s, and strings |
|---|
| 90 |
are all considered "true" when passed to these functions. |
|---|
| 91 |
Alternatively, your MUSH may be using TinyMUSH 2.2 booleans, |
|---|
| 92 |
in which case only non-zero numbers are "true". |
|---|
| 93 |
|
|---|
| 94 |
and() cand() cor() eq() gt() |
|---|
| 95 |
gte() lt() lte() nand() neq() |
|---|
| 96 |
nor() not() or() t() xor() |
|---|
| 97 |
|
|---|
| 98 |
See also: BOOLEAN VALUES, @config |
|---|
| 99 |
& Communication functions |
|---|
| 100 |
Communication functions are side-effect functions that send a message |
|---|
| 101 |
to an object or objects. |
|---|
| 102 |
|
|---|
| 103 |
cemit() emit() lemit() nsemit() nslemit() |
|---|
| 104 |
nsoemit() nspemit() nsprompt() nsremit() nszemit() |
|---|
| 105 |
oemit() pemit() prompt() remit() zemit() |
|---|
| 106 |
& Connection functions |
|---|
| 107 |
Connection functions return information about the connections open |
|---|
| 108 |
on a game, or about specific connections. |
|---|
| 109 |
|
|---|
| 110 |
cmds() conn() doing() height() hostname() |
|---|
| 111 |
hidden() idle() ipaddr() lports() lwho() |
|---|
| 112 |
lwhoid() mwho() mwhoid() nmwho() nwho() |
|---|
| 113 |
player() ports() pueblo() recv() sent() |
|---|
| 114 |
ssl() terminfo() width() xmwho() xmwhoid() |
|---|
| 115 |
xwho() xwhoid() zmwho() zwho() |
|---|
| 116 |
& Dbref functions |
|---|
| 117 |
Dbref functions return a dbref or list of dbrefs related to some value |
|---|
| 118 |
on an object. |
|---|
| 119 |
|
|---|
| 120 |
children() con() entrances() exit() followers() |
|---|
| 121 |
following() home() lcon() lexits() loc() |
|---|
| 122 |
locate() lparent() lplayers() lsearch() lvcon() |
|---|
| 123 |
lvexits() lvplayers() namelist() next() nextdbref() |
|---|
| 124 |
num() owner() parent() pmatch() rloc() |
|---|
| 125 |
rnum() room() where() zone() |
|---|
| 126 |
|
|---|
| 127 |
See also: DBREF |
|---|
| 128 |
& Information functions |
|---|
| 129 |
Information functions return values related to objects or the game. |
|---|
| 130 |
|
|---|
| 131 |
alias() andflags() andlflags() andlpowers() config() |
|---|
| 132 |
controls() ctime() elock() findable() flags() |
|---|
| 133 |
fullalias() fullname() hasattr() hasattrp() hasflag() |
|---|
| 134 |
haspower() hastype() iname() lflags() lock() |
|---|
| 135 |
lstats() money() mtime() mudname() name() |
|---|
| 136 |
nattr() nearby() objid() objmem() orflags() |
|---|
| 137 |
orlflags() orlpowers() playermem() poll() powers() |
|---|
| 138 |
quota() restarts() type() version() visible() |
|---|
| 139 |
& List functions |
|---|
| 140 |
List functions take at least one list of elements and return transformed |
|---|
| 141 |
lists or one or more members of those lists. Most of these functions |
|---|
| 142 |
can take an arbitrary <delimiter> argument to specify what delimits |
|---|
| 143 |
list elements; if none is provided, a space is used by default. |
|---|
| 144 |
|
|---|
| 145 |
element() elements() extract() filter() filterbool() |
|---|
| 146 |
first() fold() grab() graball() index() |
|---|
| 147 |
insert() itemize() items() iter() last() |
|---|
| 148 |
ldelete() map() match() matchall() member() |
|---|
| 149 |
mix() munge() namegrab() namegraball() remove() |
|---|
| 150 |
replace() rest() revwords() setdiff() setinter() |
|---|
| 151 |
setunion() shuffle() sort() sortby() sortkey() |
|---|
| 152 |
splice() step() table() unique() wordpos() |
|---|
| 153 |
words() |
|---|
| 154 |
|
|---|
| 155 |
See also: LISTS |
|---|
| 156 |
& Math functions |
|---|
| 157 |
Math functions take one or more floating point numbers and return |
|---|
| 158 |
a numeric value. |
|---|
| 159 |
abs() acos() add() asin() atan() |
|---|
| 160 |
atan2() bound() ceil() cos() ctu() |
|---|
| 161 |
dist2d() dist3d() e() exp() fdiv() |
|---|
| 162 |
floor() fmod() fraction() ln() lmath() |
|---|
| 163 |
log() max() mean() median() min() |
|---|
| 164 |
mul() pi() power() root() round() |
|---|
| 165 |
sign() sin() sqrt() stddev() sub() |
|---|
| 166 |
tan() trunc() val() |
|---|
| 167 |
|
|---|
| 168 |
These functions operate only on integers (if passed floating point |
|---|
| 169 |
numbers, they will return an error or misbehave): |
|---|
| 170 |
dec() div() floordiv() inc() mod() |
|---|
| 171 |
remainder() |
|---|
| 172 |
|
|---|
| 173 |
These functions operate on n-dimensional vectors. A vector |
|---|
| 174 |
is a delimiter-separated list of numbers (space-separated, by default): |
|---|
| 175 |
vadd() vcross() vdim() vdot() vmag() |
|---|
| 176 |
vmax() vmin() vmul() vsub() vunit() |
|---|
| 177 |
& Regular expression functions |
|---|
| 178 |
These functions take a regular expression (regexp, or re) and match |
|---|
| 179 |
it against assorted things. |
|---|
| 180 |
|
|---|
| 181 |
regedit() regeditall() regeditalli() regediti() regmatch() |
|---|
| 182 |
regmatchi() regrab() regraball() regraballi() regrabi() |
|---|
| 183 |
regrep() regrepi() reswitch() reswitchall() reswitchalli() |
|---|
| 184 |
reswitchi() |
|---|
| 185 |
|
|---|
| 186 |
See also: string functions, regexp |
|---|
| 187 |
& SQL functions |
|---|
| 188 |
These functions perform queries or other operations on an SQL |
|---|
| 189 |
database to which the MUSH is connected, if SQL support is |
|---|
| 190 |
available and enabled. |
|---|
| 191 |
|
|---|
| 192 |
sql() sqlescape() mapsql() |
|---|
| 193 |
|
|---|
| 194 |
& String functions |
|---|
| 195 |
String functions take at least one string and return a transformed |
|---|
| 196 |
string, parts of a string, or a value related to the string(s). |
|---|
| 197 |
|
|---|
| 198 |
accent() after() align() alphamin() alphamax() |
|---|
| 199 |
art() before() brackets() capstr() case() |
|---|
| 200 |
caseall() cat() center() comp() chr() |
|---|
| 201 |
decode64() decompose() decrypt() delete() digest() |
|---|
| 202 |
edit() encode64() encrypt() escape() if() |
|---|
| 203 |
ifelse() foreach() lcstr() left() lit() |
|---|
| 204 |
ljust() merge() mid() ord() ordinal() |
|---|
| 205 |
pos() regedit() lpos() regmatch() repeat() |
|---|
| 206 |
reverse() right() rjust() scramble() secure() |
|---|
| 207 |
sha0() space() spellnum() squish() strcat() |
|---|
| 208 |
strinsert() stripaccents()stripansi() strlen() strmatch() |
|---|
| 209 |
strreplace() switch() trim() ucstr() wrap() |
|---|
| 210 |
|
|---|
| 211 |
See also: STRINGS |
|---|
| 212 |
& Time functions |
|---|
| 213 |
These functions return times or format times. |
|---|
| 214 |
|
|---|
| 215 |
convsecs() convutcsecs() convtime() ctime() etimefmt() |
|---|
| 216 |
isdaylight() mtime() restarttime() secs() starttime() |
|---|
| 217 |
stringsecs() time() timefmt() timestring() utctime() |
|---|
| 218 |
|
|---|
| 219 |
& Utility functions |
|---|
| 220 |
These functions don't quite fit into any other category. |
|---|
| 221 |
|
|---|
| 222 |
allof() ansi() atrlock() beep() checkpass() |
|---|
| 223 |
clone() create() die() dig() firstof() |
|---|
| 224 |
functions() isdbref() isint() isnum() isobjid() |
|---|
| 225 |
isword() letq() localize() link() list() |
|---|
| 226 |
lnum() null() numversion() objeval() open() |
|---|
| 227 |
pcreate() r-function rand() s-function scan() |
|---|
| 228 |
set() setq() setr() soundex() soundslike() |
|---|
| 229 |
speak() tel() textentries() textfile() valid() |
|---|
| 230 |
wipe() @@() |
|---|
| 231 |
|
|---|
| 232 |
& @@() |
|---|
| 233 |
& NULL() |
|---|
| 234 |
@@(<expression>) |
|---|
| 235 |
null(<expression>[, ... , <expression>]) |
|---|
| 236 |
|
|---|
| 237 |
The @@() function does nothing and returns nothing. It could be |
|---|
| 238 |
used for commenting, perhaps. It does not evaluate its argument. |
|---|
| 239 |
|
|---|
| 240 |
The null() function is similar, but does evaluate its argument(s), |
|---|
| 241 |
so side-effects can occur within a null(). Useful for eating the |
|---|
| 242 |
output of functions when you don't use that output. |
|---|
| 243 |
& ABS() |
|---|
| 244 |
abs(<number>) |
|---|
| 245 |
|
|---|
| 246 |
Returns the absolute value of a number. i.e. ABS(-4) returns 4; |
|---|
| 247 |
ABS(2) returns 2, etc. |
|---|
| 248 |
& ACCENT() |
|---|
| 249 |
accent(<string>, <template>) |
|---|
| 250 |
|
|---|
| 251 |
The accent() function will return <string>, with characters in it |
|---|
| 252 |
possibly changed to accented ones according to <template>. Both |
|---|
| 253 |
arguments must be the same size. |
|---|
| 254 |
|
|---|
| 255 |
Whether or not the resulting string is actually displayed correctly |
|---|
| 256 |
is client-dependent. Some OSes uses different character sets than |
|---|
| 257 |
the one assumes (ISO 8859-1), and some clients strip these 8-bit |
|---|
| 258 |
characters. |
|---|
| 259 |
|
|---|
| 260 |
See 'HELP ACCENT2' for a description of the template argument. |
|---|
| 261 |
|
|---|
| 262 |
See also: stripaccents(), NOACCENTS |
|---|
| 263 |
& ACCENT2 |
|---|
| 264 |
For each character in <string>, the corresponding character of |
|---|
| 265 |
<template> is checked according to the table below, and a replacement |
|---|
| 266 |
done. If either the current <string> or <template> characters aren't |
|---|
| 267 |
in the table, the <string> character is passed through unchanged. |
|---|
| 268 |
|
|---|
| 269 |
Accent Template String |
|---|
| 270 |
Name Description Character Character |
|---|
| 271 |
-------------------------------------------------------------- |
|---|
| 272 |
grave Backward slant ` A,E,I,O,U,a,e,i,o,u |
|---|
| 273 |
above letter |
|---|
| 274 |
acute Forward slant ' A,E,I,O,U,Y,a,e,i,o,u,y |
|---|
| 275 |
above letter |
|---|
| 276 |
tilde Wavy line above ~ A,N,O,a,n,o |
|---|
| 277 |
letter |
|---|
| 278 |
circumflex carat above ^ A,E,I,O,U,a,e,i,o,u |
|---|
| 279 |
letter |
|---|
| 280 |
umlaut Two dots above : A,E,I,O,U,,a,e,i,o,u,y |
|---|
| 281 |
diaeresis letter |
|---|
| 282 |
ring Small circle above o A,a |
|---|
| 283 |
letter |
|---|
| 284 |
cedilla Small tail below , C,c |
|---|
| 285 |
letter |
|---|
| 286 |
|
|---|
| 287 |
See 'HELP ACCENT3' for more |
|---|
| 288 |
& ACCENT3 |
|---|
| 289 |
These are non-accent special characters, mostly punctuation and |
|---|
| 290 |
non-roman letters. |
|---|
| 291 |
|
|---|
| 292 |
Template String |
|---|
| 293 |
Description Character Character |
|---|
| 294 |
-------------------------------------------------------------- |
|---|
| 295 |
Upside-down ? u ? |
|---|
| 296 |
Upside-down ! u ! |
|---|
| 297 |
<< quote mark " < |
|---|
| 298 |
>> quote mark " > |
|---|
| 299 |
German sharp s B s |
|---|
| 300 |
Capital thorn | P |
|---|
| 301 |
Lower-case thorn | p |
|---|
| 302 |
Capital eth - D |
|---|
| 303 |
Lower-case eth & o |
|---|
| 304 |
|
|---|
| 305 |
See 'HELP ACCENT4' for examples |
|---|
| 306 |
& ACCENT4 |
|---|
| 307 |
Some examples of accent() and their expected outputs: |
|---|
| 308 |
|
|---|
| 309 |
> think accent(Aule, ---:) |
|---|
| 310 |
Aul(e-with-diaeresis) |
|---|
| 311 |
|
|---|
| 312 |
> think accent(The Nina was a ship, The Ni~a was a ship) |
|---|
| 313 |
The Ni(n-with-~)a was a ship |
|---|
| 314 |
|
|---|
| 315 |
> think accent(Khazad ai-menu!, Khaz^d ai-m^nu!) |
|---|
| 316 |
Khaz(a-with-^)d ai-m(e-with-^)nu! |
|---|
| 317 |
& ACCNAME() |
|---|
| 318 |
accname(<object>) |
|---|
| 319 |
|
|---|
| 320 |
accname() returns the name of object <object>, applying the object's |
|---|
| 321 |
@nameaccent, if any. |
|---|
| 322 |
|
|---|
| 323 |
Related functions: NAME(), FULLNAME(), INAME() |
|---|
| 324 |
& ACOS() |
|---|
| 325 |
acos(<cosine>[,<angle type>]) |
|---|
| 326 |
|
|---|
| 327 |
Returns the angle that has the given <cosine> (arc-cosine), with the |
|---|
| 328 |
angle expressed in the given angle type, or radians by default. |
|---|
| 329 |
|
|---|
| 330 |
See 'HELP CTU()' for more on the angle type. |
|---|
| 331 |
& ADD() |
|---|
| 332 |
add(<number>, <number>[, ... , <numberN>]) |
|---|
| 333 |
|
|---|
| 334 |
Returns the sum of some numbers. |
|---|
| 335 |
& AFTER() |
|---|
| 336 |
after(<string1>, <string2>) |
|---|
| 337 |
|
|---|
| 338 |
Returns the portion of <string1> that occurs after <string2>. |
|---|
| 339 |
If <string2> isn't in <string1>, the function returns a null string. |
|---|
| 340 |
This is case-sensitive. |
|---|
| 341 |
|
|---|
| 342 |
Examples: |
|---|
| 343 |
> think after(foo bar baz,bar) |
|---|
| 344 |
baz |
|---|
| 345 |
> think after(foo bar baz,ba) |
|---|
| 346 |
r baz |
|---|
| 347 |
|
|---|
| 348 |
See also: before(), rest() |
|---|
| 349 |
& ALIGN() |
|---|
| 350 |
align(<widths>,<col1>,...,<coln>[,<filler>[,<colsep>[,<rowsep>]]]) |
|---|
| 351 |
|
|---|
| 352 |
Creates columns of text, each column designated by <col1..coln>. |
|---|
| 353 |
Each column is individually wrapped inside its own column, allowing |
|---|
| 354 |
for easy creation of book pages, newsletters, or the like. |
|---|
| 355 |
|
|---|
| 356 |
<widths> is a space-separated list of column widths. '10 10 10' for the |
|---|
| 357 |
widths argument specifies that there are 3 columns, each 10 spaces wide. |
|---|
| 358 |
< before a number causes the field to be left-aligned (the default). A |
|---|
| 359 |
'-' causes it to be centered, and '>' makes it right-aligned. |
|---|
| 360 |
A '.' after the number implies the column is to be repeated for as long |
|---|
| 361 |
as there is text remaining in a non-repeating column. A ` (left tick) |
|---|
| 362 |
after the number implies that if the column runs out of text, it should |
|---|
| 363 |
merge with the next leftmost column (making that column flow around). |
|---|
| 364 |
A ' (right tick) after the number implies that if the column runs out |
|---|
| 365 |
of text, it should merge with the next rightmost column. |
|---|
| 366 |
|
|---|
| 367 |
<filler> is a single character that, if given, is the character used |
|---|
| 368 |
to fill empty columns and remaining spaces. <colsep>, if given, is |
|---|
| 369 |
inserted between every column, on every row. <rowsep>, if given, is |
|---|
| 370 |
inserted between every line. By default, <filler> and <colsep> are |
|---|
| 371 |
a space, and <rowsep> is a newline. |
|---|
| 372 |
|
|---|
| 373 |
Continued in HELP ALIGN2 |
|---|
| 374 |
& ALIGN2 |
|---|
| 375 |
Examples: |
|---|
| 376 |
|
|---|
| 377 |
> &line me=align(<5 10 20,\([left(xget(%0,sex),1)]\),name(%0),name(loc(%0))) |
|---|
| 378 |
> th iter(lwho(),u(line,##),%b,%r) |
|---|
| 379 |
(M) Walker Tree |
|---|
| 380 |
(F) Jane Doe Nowhere |
|---|
| 381 |
|
|---|
| 382 |
> &haiku me = Alignment function,%rIt justifies your writing,%rBut the |
|---|
| 383 |
words still suck.%rLuke |
|---|
| 384 |
|
|---|
| 385 |
> th [align(5 -40 5,,[repeat(-,40)]%r[u(haiku)]%r[repeat(-,40)],,%b,+) |
|---|
| 386 |
|
|---|
| 387 |
+----------------------------------------+ |
|---|
| 388 |
+ Alignment function, + |
|---|
| 389 |
+ It justifies your writing, + |
|---|
| 390 |
+ But the words still suck. + |
|---|
| 391 |
+ Luke + |
|---|
| 392 |
+----------------------------------------+ |
|---|
| 393 |
|
|---|
| 394 |
See also: center(), ljust(), rjust() |
|---|
| 395 |
& ALLOF() |
|---|
| 396 |
allof(<expr1>[, ... , <exprN>],<osep>) |
|---|
| 397 |
|
|---|
| 398 |
Evaluates every expression argument (including side-effects) and returns |
|---|
| 399 |
the results of those which are true, in a list separated by osep. The |
|---|
| 400 |
output separator argument is required and must be a single character, |
|---|
| 401 |
or can be left empty, in which case a space will be used to separate the |
|---|
| 402 |
results by default. |
|---|
| 403 |
|
|---|
| 404 |
The meaning of true or false depends on configuration options as |
|---|
| 405 |
explained in the 'BOOLEAN VALUES' help topics. |
|---|
| 406 |
|
|---|
| 407 |
> &s me=Bats are similar to Rats which are afraid of Cats |
|---|
| 408 |
> say allof(grab(v(s),rats),grab(v(s),mats),grab(v(s),bats),) |
|---|
| 409 |
You say, "Rats Bats" |
|---|
| 410 |
|
|---|
| 411 |
> say allof(#-1,#101,#2970,,#-3,0,#319,null(This Doesn't Count),|) |
|---|
| 412 |
You say, "#101|#2970|#319" |
|---|
| 413 |
|
|---|
| 414 |
See also: firstof(), BOOLEAN VALUES |
|---|
| 415 |
& ALPHAMAX() |
|---|
| 416 |
alphamax(<word1>[, ... , <wordN>]) |
|---|
| 417 |
|
|---|
| 418 |
Takes any number of arguments, and returns the word which is |
|---|
| 419 |
lexicographically biggest. I.e., which word would be last in |
|---|
| 420 |
alphabetical order. |
|---|
| 421 |
|
|---|
| 422 |
& ALPHAMIN() |
|---|
| 423 |
alphamin(<word1>[, ... , <wordN>]) |
|---|
| 424 |
|
|---|
| 425 |
Takes any number of arguments, and returns the word which is |
|---|
| 426 |
lexicographically smallest: the word that would be first in |
|---|
| 427 |
alphabetical order. |
|---|
| 428 |
|
|---|
| 429 |
& AND() |
|---|
| 430 |
& CAND() |
|---|
| 431 |
and(<boolean value 1>, <boolean value 2>[, ... , <boolean value N>]) |
|---|
| 432 |
cand(<boolean value 1>, <boolean value 2>[, ... , <boolean value N>]) |
|---|
| 433 |
|
|---|
| 434 |
Takes boolean values, and returns 1 if all of them are equivalent |
|---|
| 435 |
to true(1). and() always evaluates all arguments (including side |
|---|
| 436 |
effects), while cand() stops evaluation after the first argument |
|---|
| 437 |
that evaluates to false. |
|---|
| 438 |
|
|---|
| 439 |
See also: BOOLEAN VALUES, or(), xor(), not() |
|---|
| 440 |
& ANDFLAGS() |
|---|
| 441 |
andflags(<object>,<string of flag letters>) |
|---|
| 442 |
|
|---|
| 443 |
This function returns 1 if <object> has all the flags in a specified |
|---|
| 444 |
string, and 0 if it does not. The string is specified with a single |
|---|
| 445 |
letter standing for each flag, like the output of the FLAGS() |
|---|
| 446 |
function. A '!' preceding a flag letter means "not flag". |
|---|
| 447 |
|
|---|
| 448 |
Thus, ANDFLAGS(me,WD) would return 1 if I was set WIZARD and DARK. |
|---|
| 449 |
ANDFLAGS(me,W!Dc) would return 1 if I was set WIZARD, not DARK, |
|---|
| 450 |
and CONNECTED. |
|---|
| 451 |
|
|---|
| 452 |
If a letter does not correspond to any flag, <object> doesn't have it, |
|---|
| 453 |
so the function returns 0. There can be an arbitrary number of flags. Do |
|---|
| 454 |
not put spaces between flag letters. |
|---|
| 455 |
& ANDLFLAGS() |
|---|
| 456 |
andlflags(<object>, <list of flags>) |
|---|
| 457 |
|
|---|
| 458 |
This function returns 1 if <object> has all the flags in a specified |
|---|
| 459 |
list, and 0 if it does not. The list is a space-separated list of |
|---|
| 460 |
flag names. A '!' preceding a flag name means "not flag". |
|---|
| 461 |
|
|---|
| 462 |
Thus, ANDLFLAGS(me,wizard dark) would return 1 if I was set WIZARD |
|---|
| 463 |
and DARK. ANDFLAGS(me,wizard !Dark connected) would return 1 if I |
|---|
| 464 |
was set WIZARD, not DARK, and CONNECTED. |
|---|
| 465 |
|
|---|
| 466 |
If a name does not correspond to any flag, <object> doesn't have it, |
|---|
| 467 |
so the function returns 0. There can be an arbitrary number of flags. |
|---|
| 468 |
& ANDLPOWERS() |
|---|
| 469 |
andlpowers(<object>, <list of powers>) |
|---|
| 470 |
|
|---|
| 471 |
This function returns 1 if <object> has all the powers in a |
|---|
| 472 |
specified list, and 0 if it does not. The list is a space-separated |
|---|
| 473 |
list of power names. A '!' preceding a flag name means "not power". |
|---|
| 474 |
|
|---|
| 475 |
Thus, ANDLPOWERS(me, no_quota no_pay) would return 1 if I was |
|---|
| 476 |
powered no_quota and no_pay. ANDLPOWERS(me, poll !guest) would |
|---|
| 477 |
return 1 if I could change the poll and was not a guest. |
|---|
| 478 |
|
|---|
| 479 |
If a name does not correspond to any power, <object> doesn't have |
|---|
| 480 |
it, so the function returns 0. There can be an arbitrary number of |
|---|
| 481 |
powers. |
|---|
| 482 |
& ANSI() |
|---|
| 483 |
ansi(<codes>, <string>) |
|---|
| 484 |
|
|---|
| 485 |
This allows you to highlight a string using ANSI terminal effects. |
|---|
| 486 |
The codes are: |
|---|
| 487 |
|
|---|
| 488 |
f - flash F - not flash |
|---|
| 489 |
h - hilite H - not hilite |
|---|
| 490 |
u - underscore U - not underscore |
|---|
| 491 |
i - inverse I - not inverse |
|---|
| 492 |
n - normal |
|---|
| 493 |
|
|---|
| 494 |
d - default foreground D - default background |
|---|
| 495 |
x - black foreground X - black background |
|---|
| 496 |
r - red foreground R - red background |
|---|
| 497 |
g - green foreground G - green background |
|---|
| 498 |
y - yellow foreground Y - yellow background |
|---|
| 499 |
b - blue foreground B - blue background |
|---|
| 500 |
m - magenta foreground M - magenta background |
|---|
| 501 |
c - cyan foreground C - cyan background |
|---|
| 502 |
w - white foreground W - white background |
|---|
| 503 |
|
|---|
| 504 |
For example, "ansi(fc, Test)" would hilight "Test" in flashing cyan. |
|---|
| 505 |
Default foreground and background use the client's default color for |
|---|
| 506 |
fore and back. |
|---|
| 507 |
|
|---|
| 508 |
See also: ANSI, COLOR |
|---|
| 509 |
& APOSS() |
|---|
| 510 |
aposs(<object>) |
|---|
| 511 |
|
|---|
| 512 |
Returns the absolute possessive pronoun - his/hers/its/theirs - |
|---|
| 513 |
for an object. |
|---|
| 514 |
& ART() |
|---|
| 515 |
art(<string>) |
|---|
| 516 |
|
|---|
| 517 |
This function returns the proper article, "a" or "an", based on whether |
|---|
| 518 |
or not <string> begins with a vowel. |
|---|
| 519 |
& ASIN() |
|---|
| 520 |
asin(<sine>[,<angle type>]) |
|---|
| 521 |
|
|---|
| 522 |
Returns the angle with the given <sine> (arc-sine), with the angle |
|---|
| 523 |
expressed in the given angle type, or radians by default. |
|---|
| 524 |
|
|---|
| 525 |
See 'HELP CTU()' for more on the angle type. |
|---|
| 526 |
& ATAN() |
|---|
| 527 |
& ATAN2() |
|---|
| 528 |
atan(<tangent>[,<angle type>]) |
|---|
| 529 |
atan2(<number>, <number>[,<angle type>]) |
|---|
| 530 |
|
|---|
| 531 |
Returns the angle with the given <tangent> (arc-tangent), with the |
|---|
| 532 |
angle expressed in the given angle type, or radians by default. |
|---|
| 533 |
|
|---|
| 534 |
atan2(y, x) is like atan(fdiv(y, x)), except x can be 0, and the |
|---|
| 535 |
signs of both arguments are used in determining the sign of the |
|---|
| 536 |
result. It is useful in converting between cartesian and polar |
|---|
| 537 |
coordinates. |
|---|
| 538 |
|
|---|
| 539 |
See 'HELP CTU()' for more on the angle type. |
|---|
| 540 |
& ATRLOCK() |
|---|
| 541 |
atrlock(<object>/<attrib>[, <on|off>]) |
|---|
| 542 |
|
|---|
| 543 |
When given a single object/attribute pair as an argument, returns 1 |
|---|
| 544 |
if the attribute is locked, 0 if unlocked, and #-1 if the attribute |
|---|
| 545 |
doesn't exist or can't be read by the function's caller. |
|---|
| 546 |
|
|---|
| 547 |
When given a second argument of "on" (or "off"), attempts to lock |
|---|
| 548 |
(unlock) the specified attribute, as per @atrlock. |
|---|
| 549 |
& ATTRIB_SET() |
|---|
| 550 |
attrib_set(<object>/<attrib>[, <value>]) |
|---|
| 551 |
|
|---|
| 552 |
Sets or clears an attribute. With a value, it sets the attribute, |
|---|
| 553 |
without one, it clears the attribute. This is an easier-to-read |
|---|
| 554 |
replacement for the old set(<object>, <attrib>:<value>) notation, |
|---|
| 555 |
and a less destructive replacement for wipe() that won't destroy |
|---|
| 556 |
entire attribute trees in one shot. |
|---|
| 557 |
|
|---|
| 558 |
If there is a second argument, then attrib_set() will create an |
|---|
| 559 |
attribute, even if the second argument is empty (in which case |
|---|
| 560 |
attrib_set() will create an empty attribute). This means that |
|---|
| 561 |
attrib_set(me/foo,%0) will _always_ create an attribute. |
|---|
| 562 |
|
|---|
| 563 |
Of course, if the empty_attrs configuration option is turned off, |
|---|
| 564 |
then the above paragraph doesn't apply. See '@config attribs'. |
|---|
| 565 |
|
|---|
| 566 |
& BAND() |
|---|
| 567 |
band(<integer1>, <integer2>[, ... , <integerN>]) |
|---|
| 568 |
|
|---|
| 569 |
Does a bitwise AND of all its arguments, returning the result |
|---|
| 570 |
(A number with only the bits set in every argument set in it). |
|---|
| 571 |
& BASECONV() |
|---|
| 572 |
baseconv(<number>, <from base>, <to base>) |
|---|
| 573 |
|
|---|
| 574 |
Converts <number>, which is in base <from base> into base <to base>. |
|---|
| 575 |
The bases can be between 2 (binary) and 36. |
|---|
| 576 |
& BEEP() |
|---|
| 577 |
beep([<number>]) |
|---|
| 578 |
|
|---|
| 579 |
Sends <number> "alert" bell characters. <number> must be in the range |
|---|
| 580 |
1 to 5, or, if unspecified, defaults to 1. |
|---|
| 581 |
This function may only be used by royalty and wizards. |
|---|
| 582 |
|
|---|
| 583 |
& BEFORE() |
|---|
| 584 |
before(<string1>, <string2>) |
|---|
| 585 |
|
|---|
| 586 |
Returns the portion of <string1> that occurs before <string2>. |
|---|
| 587 |
If <string2> isn't in <string1>, <string1> is returned. |
|---|
| 588 |
This is case-sensitive. |
|---|
| 589 |
|
|---|
| 590 |
Examples: |
|---|
| 591 |
> think before(foo bar baz,bar) |
|---|
| 592 |
foo |
|---|
| 593 |
> think before(foo bar baz,r) |
|---|
| 594 |
foo ba |
|---|
| 595 |
|
|---|
| 596 |
See also: after(), first() |
|---|
| 597 |
& BRACKETS() |
|---|
| 598 |
brackets([<string>]) |
|---|
| 599 |
|
|---|
| 600 |
Returns a count of the number of left and right square brackets, |
|---|
| 601 |
parentheses, and curly braces in the string, in that order, as a |
|---|
| 602 |
space-separated list of numbers. This is useful for finding missing |
|---|
| 603 |
or extra brackets in MUSH code. |
|---|
| 604 |
|
|---|
| 605 |
Example: |
|---|
| 606 |
> @desc me=This is [ansi(h,a test)] of the { brackets() function. |
|---|
| 607 |
> think brackets(v(desc)) |
|---|
| 608 |
1 1 2 2 1 0 |
|---|
| 609 |
& BNAND() |
|---|
| 610 |
bnand(<integer>, <integer>) |
|---|
| 611 |
|
|---|
| 612 |
Returns its first argument with every bit that was set in the second |
|---|
| 613 |
argument cleared. |
|---|
| 614 |
& BNOT() |
|---|
| 615 |
bnot(<integer>) |
|---|
| 616 |
|
|---|
| 617 |
Returns the bitwise complement of its argument. Every bit set in it |
|---|
| 618 |
is cleared, and every clear bit is set. |
|---|
| 619 |
& BOR() |
|---|
| 620 |
bor(<integer>, <integer>[, ... , <integerN>]) |
|---|
| 621 |
|
|---|
| 622 |
Does a bitwise OR of all its arguments, returning the result. |
|---|
| 623 |
(A number with a bit set if that bit appears in any of its arguments). |
|---|
| 624 |
& BOUND() |
|---|
| 625 |
bound(<number>, <lower bound>, <higher bound>) |
|---|
| 626 |
|
|---|
| 627 |
bound() returns <number> if it is between <lower bound> and |
|---|
| 628 |
<higher bound>. If it's lower than the lower bound, the lower |
|---|
| 629 |
bound is returned. If it's higher than the higher bound, |
|---|
| 630 |
the higher bound is returned. |
|---|
| 631 |
|
|---|
| 632 |
See also: ceil(), floor(), round(), trunc() |
|---|
| 633 |
& BXOR() |
|---|
| 634 |
bxor(<integer>, <integer>[, ... , <integerN>]) |
|---|
| 635 |
|
|---|
| 636 |
Does a bitwise XOR of all its arguments, returning the result. |
|---|
| 637 |
(A number with a bit set if it's set in only one of its arguments). |
|---|
| 638 |
& CAPSTR() |
|---|
| 639 |
capstr(<string>) |
|---|
| 640 |
|
|---|
| 641 |
Returns <string> with the first character capitalized. |
|---|
| 642 |
Example: capstr(foo bar baz) returns "Foo bar baz" |
|---|
| 643 |
|
|---|
| 644 |
See also: lcstr(), ucstr() |
|---|
| 645 |
& CAT() |
|---|
| 646 |
cat(<string1>[, ... , <stringN>]) |
|---|
| 647 |
|
|---|
| 648 |
cat() concatenates strings, separating each string by a space. |
|---|
| 649 |
So "[cat(one, two)]" will return 'one two'. |
|---|
| 650 |
|
|---|
| 651 |
See also: strcat() |
|---|
| 652 |
& CEIL() |
|---|
| 653 |
ceil(<number>) |
|---|
| 654 |
|
|---|
| 655 |
Returns the least integral value greater than or equal to <number>. |
|---|
| 656 |
|
|---|
| 657 |
See also: floor(), bound(), round(), trunc() |
|---|
| 658 |
& CENTER() |
|---|
| 659 |
center(<string>, <width>[, <fill>[, <rightfill>]]) |
|---|
| 660 |
|
|---|
| 661 |
This function will center <string> within a field <width> characters wide, |
|---|
| 662 |
using the <fill> string for padding on the left side of the string, |
|---|
| 663 |
and <rightfill> for padding on the right side. <rightfill> defaults |
|---|
| 664 |
to the mirror-image of <fill> if not specified. <fill> defaults to |
|---|
| 665 |
a space if neither <fill> nor <rightfill> are specified. |
|---|
| 666 |
|
|---|
| 667 |
If <string> divides <width> into uneven portions, the left side |
|---|
| 668 |
will be one character shorter than the right side. |
|---|
| 669 |
|
|---|
| 670 |
Examples: |
|---|
| 671 |
> say center(X,5,-) |
|---|
| 672 |
You say, "--X--" |
|---|
| 673 |
> say center(X,5,-=) |
|---|
| 674 |
You say, "-=X=-" |
|---|
| 675 |
> say center(.NEAT.,15,-,=) |
|---|
| 676 |
You say, "----.NEAT.=====" |
|---|
| 677 |
> say center(hello,16,12345) |
|---|
| 678 |
You say, "12345hello543215" |
|---|
| 679 |
|
|---|
| 680 |
See also: align(), ljust(), rjust() |
|---|
| 681 |
& CHECKPASS() |
|---|
| 682 |
checkpass(<player>, <string>) |
|---|
| 683 |
|
|---|
| 684 |
Returns 1 if <string> matches the player's password otherwise 0. |
|---|
| 685 |
If <player> has no password, this function will always return 1. |
|---|
| 686 |
<player> should be specified as a dbref or *<name>. |
|---|
| 687 |
|
|---|
| 688 |
This function is restricted to wizards. |
|---|
| 689 |
|
|---|
| 690 |
& CHR() |
|---|
| 691 |
& ORD() |
|---|
| 692 |
chr(<number>) |
|---|
| 693 |
ord(<character>) |
|---|
| 694 |
|
|---|
| 695 |
ord() returns the numerical value of the given character. |
|---|
| 696 |
chr() returns the character with the given numerical value. |
|---|
| 697 |
|
|---|
| 698 |
Examples: |
|---|
| 699 |
> think ord(A) |
|---|
| 700 |
65 |
|---|
| 701 |
> think chr(65) |
|---|
| 702 |
A |
|---|
| 703 |
& CLONE() |
|---|
| 704 |
clone(<object>) |
|---|
| 705 |
|
|---|
| 706 |
This function clones <object>, and returns the dbref number of the clone. |
|---|
| 707 |
|
|---|
| 708 |
This is a side-effect function and may not be enabled on some MUSHes. |
|---|
| 709 |
& CMDS() |
|---|
| 710 |
cmds(<player|descriptor>) |
|---|
| 711 |
|
|---|
| 712 |
Returns the number of commands issued by a player during this |
|---|
| 713 |
connection as indicated by WHO. |
|---|
| 714 |
|
|---|
| 715 |
The caller can use the function on himself, but using on any other |
|---|
| 716 |
player requires privileged power such as Wizard, Royalty or SEE_ALL. |
|---|
| 717 |
|
|---|
| 718 |
See also: Connection Functions |
|---|
| 719 |
& SENT() |
|---|
| 720 |
sent(<player|descriptor>) |
|---|
| 721 |
|
|---|
| 722 |
Returns the number of characters sent by a player during this |
|---|
| 723 |
connection as indicated by SESSION. |
|---|
| 724 |
|
|---|
| 725 |
The caller can use the function on himself, but using on any other |
|---|
| 726 |
player requires privileged power such as Wizard, Royalty or SEE_ALL. |
|---|
| 727 |
|
|---|
| 728 |
See also: Connection Functions |
|---|
| 729 |
& RECV() |
|---|
| 730 |
recv(<player|descriptor>) |
|---|
| 731 |
|
|---|
| 732 |
Returns the number of characters received by a player during this |
|---|
| 733 |
connection as indicated by SESSION. |
|---|
| 734 |
|
|---|
| 735 |
The caller can use the function on himself, but using on any other |
|---|
| 736 |
player requires privileged power such as Wizard, Royalty or SEE_ALL. |
|---|
| 737 |
|
|---|
| 738 |
See also: Connection Functions |
|---|
| 739 |
& COMP() |
|---|
| 740 |
comp(<value1>, <value2>[,<type>]) |
|---|
| 741 |
|
|---|
| 742 |
Comp compares two values. It returns 0 if they are the same, -1 if |
|---|
| 743 |
value1 is less than/precedes alphabetically value2, and 1 |
|---|
| 744 |
otherwise. |
|---|
| 745 |
|
|---|
| 746 |
By default the comparison is a case-sensitive lexicographic (string) |
|---|
| 747 |
comparison. By giving the optional <type>, the comparison can |
|---|
| 748 |
be specified: |
|---|
| 749 |
<type> Comparison |
|---|
| 750 |
A Maybe case-sensitive lexicographic (default) |
|---|
| 751 |
I Always case-insensitive lexicographic |
|---|
| 752 |
D Dbrefs of valid objects |
|---|
| 753 |
N Integers |
|---|
| 754 |
F Floating point numbers |
|---|
| 755 |
|
|---|
| 756 |
Whether or not the a sort type is case-sensitive or not depends |
|---|
| 757 |
on the particular mush and its environment. |
|---|
| 758 |
& CON() |
|---|
| 759 |
con(<object>) |
|---|
| 760 |
|
|---|
| 761 |
Returns the dbref of the first object in a container. |
|---|
| 762 |
|
|---|
| 763 |
You can get the complete contents of any container you may examine, |
|---|
| 764 |
regardless of whether or not objects are dark. You can get the |
|---|
| 765 |
partial contents (obeying DARK/LIGHT/etc.) of your current location |
|---|
| 766 |
or the enactor (%#). You CANNOT get the contents of anything else, |
|---|
| 767 |
regardless of whether or not you have objects in it. |
|---|
| 768 |
|
|---|
| 769 |
See also: lcon(), next() |
|---|
| 770 |
& COND() |
|---|
| 771 |
& CONDALL() |
|---|
| 772 |
& NCOND() |
|---|
| 773 |
& NCONDALL() |
|---|
| 774 |
cond(<cond1>, <expr1>, [<condN>, <exprN>], ...[<default>]) |
|---|
| 775 |
condall(<cond1>, <expr1>, [<condN>, <exprN>], ...[<default>]) |
|---|
| 776 |
ncond(<cond1>, <expr1>, [<condN>, <exprN>], ...[<default>]) |
|---|
| 777 |
ncondall(<cond1>, <expr1>, [<condN>, <exprN>], ...[<default>]) |
|---|
| 778 |
|
|---|
| 779 |
cond() evaluates <cond>s until one returns a boolean true value. Should |
|---|
| 780 |
none return true, <default> is returned. |
|---|
| 781 |
|
|---|
| 782 |
condall() returns all <expr>s for those <cond>s that evaluate to true. |
|---|
| 783 |
|
|---|
| 784 |
ncond() and ncondall() are identical to cond(), except it returns <expr>s |
|---|
| 785 |
for which <cond>s evaluate to false. |
|---|
| 786 |
|
|---|
| 787 |
Examples: |
|---|
| 788 |
> say cond(0,This is false,#-1,This is also false,#123,This is true) |
|---|
| 789 |
You say, "This is true" |
|---|
| 790 |
|
|---|
| 791 |
> say ncond(0,This is false,#-1,This is also false,#123,This is true) |
|---|
| 792 |
You say, "This is false" |
|---|
| 793 |
|
|---|
| 794 |
> say ncondall(0,This is false,#-1,This is also false,#123,This is true) |
|---|
| 795 |
You say, "This is falseThis is also false" |
|---|
| 796 |
& CONFIG() |
|---|
| 797 |
config() |
|---|
| 798 |
config(<option>) |
|---|
| 799 |
|
|---|
| 800 |
With no arguments, this function returns a list of config option names. |
|---|
| 801 |
Given a config option name, this function returns its value. |
|---|
| 802 |
Boolean configuration options will return values of "Yes" or "No". |
|---|
| 803 |
|
|---|
| 804 |
Ex: config(money_singular) => "Penny" |
|---|
| 805 |
|
|---|
| 806 |
& CONN() |
|---|
| 807 |
conn(<player|descriptor>) |
|---|
| 808 |
|
|---|
| 809 |
This function returns the number of seconds a player has been connected. |
|---|
| 810 |
<player name> must be the full name of a player, or a player's dbref. |
|---|
| 811 |
Players who are not connected have a conn value of "-1", as do dark |
|---|
| 812 |
wizards, when conn() is used on them by a non-priv'ed player. |
|---|
| 813 |
|
|---|
| 814 |
See also: CONNECTED |
|---|
| 815 |
& CONTROLS() |
|---|
| 816 |
controls(<object>, <victim>) |
|---|
| 817 |
|
|---|
| 818 |
This function returns 1 if <object> controls <victim>, or 0, if |
|---|
| 819 |
it does not. If one of the objects does not exist, it will return |
|---|
| 820 |
#-1 ARGN NOT FOUND (where N is the argument which is the invalid |
|---|
| 821 |
object). You must control <object> or <victim>, or have the See_All |
|---|
| 822 |
power, to use this function. |
|---|
| 823 |
|
|---|
| 824 |
See also: CONTROL |
|---|
| 825 |
|
|---|
| 826 |
& CONVSECS() |
|---|
| 827 |
& CONVUTCSECS() |
|---|
| 828 |
convsecs(<seconds>[, <zone>]) |
|---|
| 829 |
convutcsecs(<seconds>) |
|---|
| 830 |
|
|---|
| 831 |
This function converts seconds to a time string, based on how many |
|---|
| 832 |
seconds the number is after Jan 1, 1970 UTC. Because it's based on |
|---|
| 833 |
UTC, but returns local time, convsecs(0) is not going to be |
|---|
| 834 |
"Thu Jan 1 00:00:00 1970" unless you're in the UTC (GMT) timezone. |
|---|
| 835 |
|
|---|
| 836 |
convutcsecs() and convsecs() with a second argument of 'utc' return |
|---|
| 837 |
the time based on UTC time instead of the server's local time. |
|---|
| 838 |
|
|---|
| 839 |
Examples: |
|---|
| 840 |
> say [secs()] |
|---|
| 841 |
You say, "709395750" |
|---|
| 842 |
> say [convsecs(709395750)] |
|---|
| 843 |
You say, "Wed Jun 24 10:22:54 1992" |
|---|
| 844 |
> say [convutcsecs(709395750)] |
|---|
| 845 |
You say, "Wed Jun 24 14:22:30 1992" |
|---|
| 846 |
|
|---|
| 847 |
See also: convtime(), time() |
|---|
| 848 |
& CONVTIME() |
|---|
| 849 |
convtime(<time string>) |
|---|
| 850 |
|
|---|
| 851 |
This functions converts a time string (in the local time zone) to the |
|---|
| 852 |
number of seconds since Jan 1, 1970 GMT. A time string is of the |
|---|
| 853 |
format: Ddd MMM DD HH:MM:SS YYYY where Ddd is the day of the week, |
|---|
| 854 |
MMM is the month, DD is the day of the month, HH is the hour in |
|---|
| 855 |
24-hour time, MM is the minutes, SS is the seconds, and YYYY is the |
|---|
| 856 |
year. If you supply an incorrectly formatted string, it will return |
|---|
| 857 |
-1. |
|---|
| 858 |
|
|---|
| 859 |
If the extended convtime() is supported (See @config compile), more |
|---|
| 860 |
formats for the date are enabled, including ones missing the day |
|---|
| 861 |
of week and year, and a 'Month Day Year' format. |
|---|
| 862 |
|
|---|
| 863 |
Example: |
|---|
| 864 |
> say [time()] |
|---|
| 865 |
You say, "Wed Jun 24 10:22:54 1992" |
|---|
| 866 |
> say [convtime(Wed Jun 24 10:22:54 1992)] |
|---|
| 867 |
You say, "709395774" |
|---|
| 868 |
|
|---|
| 869 |
See also: convsecs(), time() |
|---|
| 870 |
& COS() |
|---|
| 871 |
cos(<angle>[,<angle type>]) |
|---|
| 872 |
|
|---|
| 873 |
Returns the cosine of <angle>. Angle must be in the given angle |
|---|
| 874 |
type, or radians by default. |
|---|
| 875 |
|
|---|
| 876 |
Examples: |
|---|
| 877 |
> say cos(90, d) |
|---|
| 878 |
You say, "0" |
|---|
| 879 |
> say cos(1.570796) |
|---|
| 880 |
You say, "0" |
|---|
| 881 |
|
|---|
| 882 |
See 'HELP CTU()' for more on the angle type. |
|---|
| 883 |
& PCREATE() |
|---|
| 884 |
pcreate(<name>, <password>) |
|---|
| 885 |
|
|---|
| 886 |
Creates a player with a given name and password. Wizard-only. |
|---|
| 887 |
|
|---|
| 888 |
See also: @pcreate |
|---|
| 889 |
& CREATE() |
|---|
| 890 |
create(<object>, <cost>) |
|---|
| 891 |
|
|---|
| 892 |
This function creates an object with name <object> for <cost> pennies, |
|---|
| 893 |
and returns the dbref number of the created object. |
|---|
| 894 |
|
|---|
| 895 |
This is a side-effect function and may not be enabled on some MUSHes. |
|---|
| 896 |
& CTIME() |
|---|
| 897 |
& CSECS() |
|---|
| 898 |
ctime(<object>[, <utc>]) |
|---|
| 899 |
csecs(<objecct>) |
|---|
| 900 |
|
|---|
| 901 |
If creation times are enabled, this function will return the |
|---|
| 902 |
date and time that the object was created. If the optional <utc> |
|---|
| 903 |
argument is true, the time is returned for the UTC time zone, if |
|---|
| 904 |
false or present, for the local time zone. |
|---|
| 905 |
|
|---|
| 906 |
csecs() returns the time as the number of seconds since the epoch. |
|---|
| 907 |
|
|---|
| 908 |
You must be able to examine an object to see its creation time. |
|---|
| 909 |
|
|---|
| 910 |
See also: mtime() |
|---|
| 911 |
& CTU() |
|---|
| 912 |
ctu(<angle>,<from>,<to>) |
|---|
| 913 |
|
|---|
| 914 |
Converts between the different ways to measure angles. |
|---|
| 915 |
<from> controls what the angle is treated as, and <to> what form |
|---|
| 916 |
it is turned into. They can be 'd' for degrees, or 'r' for radians. |
|---|
| 917 |
There is also a third way to measure angle, 'g' for gradians, but it's not |
|---|
| 918 |
used often and is only included for completeness. |
|---|
| 919 |
|
|---|
| 920 |
As a refresher, there are 180 degrees in pi radians in 200 gradians. |
|---|
| 921 |
|
|---|
| 922 |
Example: |
|---|
| 923 |
> say 90 degrees is [ctu(90, d, r)] radians |
|---|
| 924 |
You say, "90 degrees is 1.570796 radians" |
|---|
| 925 |
& DEC() |
|---|
| 926 |
dec(<integer>) |
|---|
| 927 |
dec(<string-ending-in-integer>) |
|---|
| 928 |
|
|---|
| 929 |
Dec returns the integer minus 1. If given a string that ends in an integer, |
|---|
| 930 |
it decrements only the final integer portion. That is: |
|---|
| 931 |
|
|---|
| 932 |
> think dec(3) |
|---|
| 933 |
2 |
|---|
| 934 |
> think dec(hi3) |
|---|
| 935 |
hi2 |
|---|
| 936 |
> think dec(1.3.3) |
|---|
| 937 |
1.3.2 |
|---|
| 938 |
> think dec(1.3) |
|---|
| 939 |
1.2 |
|---|
| 940 |
|
|---|
| 941 |
Note especially the last example, which will trip you up if you use |
|---|
| 942 |
floating point numbers with dec() and expect it to work like sub(). |
|---|
| 943 |
|
|---|
| 944 |
See also: inc() |
|---|
| 945 |
& DECOMPOSE() |
|---|
| 946 |
decompose(<string>) |
|---|
| 947 |
|
|---|
| 948 |
decompose() works like escape() with the additional caveat that it inserts |
|---|
| 949 |
parse-able characters to recreate <string> exactly after one parsing. It |
|---|
| 950 |
takes care of multiple spaces, '%r's, and '%t's. |
|---|
| 951 |
|
|---|
| 952 |
See also: @decompile2, escape(), secure() |
|---|
| 953 |
& DECODE64() |
|---|
| 954 |
decode64(<string>) |
|---|
| 955 |
|
|---|
| 956 |
Converts the base 64-encoded <string> back to its original form. |
|---|
| 957 |
|
|---|
| 958 |
Requires SSL support; see @config compile. |
|---|
| 959 |
|
|---|
| 960 |
See also: encode64() |
|---|
| 961 |
& DECRYPT() |
|---|
| 962 |
decrypt(<string>, <password>[, <encoded>]) |
|---|
| 963 |
|
|---|
| 964 |
Decrypts a string encrypted with the encrypt() function, if given |
|---|
| 965 |
the string and the same password. |
|---|
| 966 |
|
|---|
| 967 |
If the optional <encoded> argument is true, it indicates that the |
|---|
| 968 |
input string is encoded in base 64. |
|---|
| 969 |
|
|---|
| 970 |
See also: encrypt(), encode64() |
|---|
| 971 |
& DEFAULT() |
|---|
| 972 |
default([<obj>/]<attr>[, ... ,[<obj>]/<attr>], <default case>) |
|---|
| 973 |
|
|---|
| 974 |
This function returns the value of the first possible <obj>/<attr>, |
|---|
| 975 |
as if retrieved via the get() function, if the attribute exists and |
|---|
| 976 |
is readable by you. Otherwise, it evaluates the default case, and |
|---|
| 977 |
returns that. Note that the default case is only evaluated if the |
|---|
| 978 |
attribute does not exist or cannot be read. Note further than an empty |
|---|
| 979 |
attribute counts as an existing attribute. |
|---|
| 980 |
|
|---|
| 981 |
This is useful for code that needs to return the value of an attribute, |
|---|
| 982 |
or an error message or default case, if that attribute does not exist. |
|---|
| 983 |
|
|---|
| 984 |
Examples: |
|---|
| 985 |
> &TEST me=apple orange banana |
|---|
| 986 |
> say default(me/Test, No fruits!) |
|---|
| 987 |
You say "apple orange banana" |
|---|
| 988 |
> &TEST ME |
|---|
| 989 |
> say default(me/Test, No fruits!) |
|---|
| 990 |
You say "No fruits!" |
|---|
| 991 |
|
|---|
| 992 |
See also: get(), eval(), ufun(), edefault(), udefault(), uldefault() |
|---|
| 993 |
|
|---|
| 994 |
& DELETE() |
|---|
| 995 |
delete(<string>, <first>, <len>) |
|---|
| 996 |
|
|---|
| 997 |
Return a modified <string>, with <len> characters starting after the |
|---|
| 998 |
character at position <first> deleted. In other words, it copies <first> |
|---|
| 999 |
characters, skips <len> characters>, and then copies the remainder of |
|---|
| 1000 |
the string. If <len> is negative, deletes characters leftwards from <first>. |
|---|
| 1001 |
Characters are numbered starting at 0. |
|---|
| 1002 |
|
|---|
| 1003 |
Examples: |
|---|
| 1004 |
> say delete(abcdefgh, 3, 2) |
|---|
| 1005 |
You say, "abcfgh" |
|---|
| 1006 |
> say delete(abcdefgh, 3, -2) |
|---|
| 1007 |
You say, "abefgh" |
|---|
| 1008 |
|
|---|
| 1009 |
See also: strreplace() |
|---|
| 1010 |
& DIE() |
|---|
| 1011 |
die(<number of times to roll die>, <number of sides on die>[, <show>]) |
|---|
| 1012 |
|
|---|
| 1013 |
This function simulates rolling dice. It "rolls" a die with a given |
|---|
| 1014 |
number of sides, a certain number of times, and sums the results. |
|---|
| 1015 |
For example, DIE(2, 6) would roll "2d6" - two six-sided dice, |
|---|
| 1016 |
generating a result in the range 2-12. The maximum number of |
|---|
| 1017 |
dice this function will roll in a single call is 20. |
|---|
| 1018 |
If a third argument is given and it's a true value, the result will |
|---|
| 1019 |
be a space-seperated list of the individual rolls rather than their |
|---|
| 1020 |
sum. |
|---|
| 1021 |
|
|---|
| 1022 |
Examples: |
|---|
| 1023 |
> think die(3, 6) |
|---|
| 1024 |
6 |
|---|
| 1025 |
> think die(3, 6, 1) |
|---|
| 1026 |
5 2 1 |
|---|
| 1027 |
& DIG() |
|---|
| 1028 |
dig(<name>[, <exit to>[, <exit from>]]) |
|---|
| 1029 |
|
|---|
| 1030 |
This function digs a room called <name>, and optionally opens and links |
|---|
| 1031 |
<exit to> and <exit from>, like the normal @dig command. It returns |
|---|
| 1032 |
the dbref number of the new room. |
|---|
| 1033 |
|
|---|
| 1034 |
This is a side-effect function and may not be enabled on some MUSHes. |
|---|
| 1035 |
& DIGEST() |
|---|
| 1036 |
digest(<algorithm>, <string>) |
|---|
| 1037 |
|
|---|
| 1038 |
Returns a checksum (Hash, digest, etc.) of <string> using the given |
|---|
| 1039 |
<algorithm>. If the mush is compiled with SSL support (See @config |
|---|
| 1040 |
compile), <algorithm> can be one of: |
|---|
| 1041 |
|
|---|
| 1042 |
md2 md4 md5 sha sha1 dss1 mdc2 ripemd160 |
|---|
| 1043 |
|
|---|
| 1044 |
Without SSL, only the sha algorithm is enabled. In both cases, sha returns |
|---|
| 1045 |
the same thing as the sha0() function. |
|---|
| 1046 |
|
|---|
| 1047 |
See also: sha0() |
|---|
| 1048 |
& DIST2D() |
|---|
| 1049 |
dist2d(<x1>, <y1>, <x2>, <y2>) |
|---|
| 1050 |
|
|---|
| 1051 |
Returns the distance between two points in the Cartesian |
|---|
| 1052 |
plane that have coordinates (<x1>, <y1>) and (<x2>, <y2>). |
|---|
| 1053 |
& DIST3D() |
|---|
| 1054 |
dist3d(<x1>, <y1>, <z1>, <x2>, <y2>, <z2>) |
|---|
| 1055 |
|
|---|
| 1056 |
Returns the distance between two points in space, with |
|---|
| 1057 |
coordinates (<x1>, <y1>, <z1>) and (<x2>, <y2>, <z2>). |
|---|
| 1058 |
& DIV() |
|---|
| 1059 |
& FLOORDIV() |
|---|
| 1060 |
div(<number>, <number>) |
|---|
| 1061 |
floordiv(<number>, <number>) |
|---|
| 1062 |
|
|---|
| 1063 |
Div returns the integer part of the quotient of the first number |
|---|
| 1064 |
divided by the second number. Floordiv returns the largest integer |
|---|
| 1065 |
less than or equal to the quotient of the first number divided by |
|---|
| 1066 |
the second. For positive numbers, these are the same thing, but |
|---|
| 1067 |
for negative numbers they may be different: |
|---|
| 1068 |
|
|---|
| 1069 |
div(13,4) ==> 3 and floordiv(13,4) ==> 3 |
|---|
| 1070 |
div(-13,4) ==> -3 but floordiv(-13,4) ==> -4 |
|---|
| 1071 |
div(13,-4) ==> -3 but floordiv(13,-4) ==> -4 |
|---|
| 1072 |
div(-13,-4) ==> 3 and floordiv(-13,-4) ==> 3 |
|---|
| 1073 |
|
|---|
| 1074 |
Note that add(mul(div(%0,%1),%1),remainder(%0,%1)) always yields %0, |
|---|
| 1075 |
and add(mul(floordiv(%0,%1),%1),modulo(%0,%1)) also always yields %0. |
|---|
| 1076 |
|
|---|
| 1077 |
See also: modulo(), fdiv() |
|---|
| 1078 |
& DOING() |
|---|
| 1079 |
doing(<player|descriptor>) |
|---|
| 1080 |
|
|---|
| 1081 |
Given the name of a connected player, returns that player's @doing |
|---|
| 1082 |
string if they can be seen on the WHO list. |
|---|
| 1083 |
|
|---|
| 1084 |
See also: @poll, @doing, poll() |
|---|
| 1085 |
& E() |
|---|
| 1086 |
e() |
|---|
| 1087 |
|
|---|
| 1088 |
Returns the value of "e" (2.71828182845904523536, rounded to the |
|---|
| 1089 |
game's float_precision setting). |
|---|
| 1090 |
& EDEFAULT() |
|---|
| 1091 |
edefault([<obj>/]<attr>, <default case>) |
|---|
| 1092 |
|
|---|
| 1093 |
This function returns the evaluated value of <obj>/<attr>, as if |
|---|
| 1094 |
retrieved via the get_eval() function, if the attribute exists and |
|---|
| 1095 |
is readable by you. Otherwise, it evaluates the default case, and |
|---|
| 1096 |
returns that. The default case is only evaluated if the attribute |
|---|
| 1097 |
does not exist or cannot be read. |
|---|
| 1098 |
|
|---|
| 1099 |
Example: |
|---|
| 1100 |
> &TEST me=You have lost [rand(10)] marbles. |
|---|
| 1101 |
> say edefault(me/Test,You have no marbles.) |
|---|
| 1102 |
You say "You have lost 6 marbles." |
|---|
| 1103 |
> &TEST me |
|---|
| 1104 |
> say edefault(me/Test,You have no marbles.) |
|---|
| 1105 |
You say "You have no marbles." |
|---|
| 1106 |
|
|---|
| 1107 |
See also: get(), eval(), ufun(), default(), udefault() |
|---|
| 1108 |
|
|---|
| 1109 |
& EDIT() |
|---|
| 1110 |
edit(<string>, <search>, <replace>[, ... , <searchN>, <replaceN>]) |
|---|
| 1111 |
|
|---|
| 1112 |
This functions in a similar way to the @edit command; instead of |
|---|
| 1113 |
taking an attribute from an object, it takes an arbitrary string. |
|---|
| 1114 |
It searches the string for <search> and replaces with <replace>, |
|---|
| 1115 |
then repeats the process if additional search-replace pairs are |
|---|
| 1116 |
given. |
|---|
| 1117 |
|
|---|
| 1118 |
If <search> is a caret (^), <replace> is prepended. |
|---|
| 1119 |
If <search> is a dollar sign ($), <replace> is appended. |
|---|
| 1120 |
If <search> is an empty string, <replace> is inserted between |
|---|
| 1121 |
every character, and before the first and after the last. |
|---|
| 1122 |
If <replace> is an empty string, <search> is deleted from the string. |
|---|
| 1123 |
|
|---|
| 1124 |
Example: |
|---|
| 1125 |
> say [edit(this is a test,^,I think%b,$,.,a test,an exam)] |
|---|
| 1126 |
You say "I think this is an exam." |
|---|
| 1127 |
|
|---|
| 1128 |
edit() can not replace a literal single ^ or $. Use regedit() for that. |
|---|
| 1129 |
|
|---|
| 1130 |
See also: @edit, regedit() |
|---|
| 1131 |
& ELEMENT() |
|---|
| 1132 |
element(&l |
|---|