=== help raise() ==================================
Syntax: raise (code [, STR message [, value]]) => none
=== help random() ================================
Syntax: random (num <mod>) => num
=== help read() ==================================
Syntax: read ([obj <player>]) => str
These restrictions on the use of `read()' without an explicit argument preserve the following simple invariant: if input is being read from a player, it is for the task started by the last command that player typed. This invariant adds responsibility to the programmer, however.
If your program calls another verb before doing a `read()', then that verb must also not suspend. As an example, consider the following, which refers to the verbs programmed in the `suspend()' example in `help suspend()':
.program #0:read_twice_A s = read(); /* success depends on programmer's permissions */ #0:callee_A(); /* callee_A does not suspend */ t = read(); /* success depends on programmer's permissions */ . .program #0:read_twice_B s = read(); /* success depends on programmer's permissions */ #0:callee_B(); /* callee_B does suspend */ t = read(); /* fails, returning E_PERM */. In three of the four calls to `read()', success depends on on the programmer's permissions. However, the second `read()' in `#0:read_twice_B' always fails and returns `E_PERM'. This is because the task was suspended, even though `#0:read_twice_B' did not do the actual suspending. Hence, if you want to read some input (by using `read()' directly or by calling other verbs which do the reading), you must make sure that the task is not suspended before the reading. This includes making sure that any verbs you call, directly or indirectly, also do not suspend.
It is possible to call `read()' many times in the same command task, so long as the task does not call `suspend()' or an explicit argument is given. The best use for `read()' with an explicit argument is in conjunction with `open_network_connection()', if it is enabled.
=== help recycle() ================================
Syntax: recycle (obj <object>) => none
After <object> is recycled, if the owner of the former object has a property named `ownership_quota' and the value of that property is a number, then `recycle()' treats that value as a "quota" and increments it by one, storing the result back into the `ownership_quota' property.
=== help renumber() ==============================
Syntax: renumber (obj <object>) => obj
The references to <object> in the parent/children and location/contents hierarchies are updated to use the new object number, and any verbs, properties and/or objects owned by <object> are also changed to be owned by the new object number. The latter operation can be quite time consuming if the database is large. No other changes to the database are performed; in particular, no object references in property values or verb code are updated.
This operation is intended for use in making new versions of the LambdaCore database from the then-current LambdaMOO database, and other similar situations. Its use requires great care.
=== help reset_max_object() ========================
Syntax: reset_max_object () => none
=== help resume() ================================
Syntax: resume (INT task-id [, value]) => none
=== help rindex() =================================
Syntax: index (str <str1>, str <str2> [, <case-matters>]) => num
index (str <str1>, str <str2> [, <case-matters>]) => num
index("foobar", "o") => 2 rindex("foobar", "o") => 3 index("foobar", "x") => 0 index("foobar", "oba") => 3 index("Foobar", "foo", 1) => 0
=== help rmatch() =================================
Syntax: match (str <subject>, str <pattern> [, <case-matters>]) => list
rmatch (str <subject>, str <pattern> [, <case-matters>]) => list
The list that `match()' (`rmatch()') returns contains the details about the match made. The list is in the form:
{<start>, <end>, <replacements>, <subject>}where <start> is the index in STRING of the beginning of the match, <end> is the index of the end of the match, <replacements> is a list described below, and <subject> is the same string that was given as the first argument to the `match()' or `rmatch()'.
The <replacements> list is always nine items long, each item itself being a list of two numbers, the start and end indices in <subject> matched by some parenthesized sub-pattern of <pattern>. The first item in <replacements> carries the indices for the first parenthesized sub-pattern, the second item carries those for the second sub-pattern, and so on.
If there are fewer than nine parenthesized sub-patterns in <pattern>, or if some sub-pattern was not used in the match, then the corresponding item in <replacements> is the list {0, -1}. See the discussion of `%)' in `help regular-expressions', for more information on parenthesized sub-patterns.
match("foo", "f*o") => {1, 2, {{0, -1}, ...}, "foo"} match("foo", "fo*") => {1, 3, {{0, -1}, ...}, "foo"} match("foobar", "o*b") => {2, 4, {{0, -1}, ...}, "foobar"} rmatch("foobar", "o*b") => {4, 4, {{0, -1}, ...}, "foobar"} match("foobar", "f%(o*%)b") => {1, 4, {{2, 3}, {0, -1}, ...}, "foobar"}See `help regular-expressions' for information on the syntax and semantics of patterns.
=== help seconds_left() ============================
Syntax: ticks_left () => num
seconds_left () => num
=== help server_log() ==============================
Syntax: server_log (str <message> [, <is-error>]) => none
=== help server_version() ===========================
Syntax: server_version () => str
"<major>.<minor>.<release>"where <major>, <minor>, and <release> are all decimal numbers.
The major version number changes very slowly, only when existing MOO code might stop working, due to an incompatible change in the syntax or semantics of the programming language, or when an incompatible change is made to the database format.
The minor version number changes more quickly, whenever an upward-compatible change is made in the programming language syntax or semantics. The most common cause of this is the addition of a new kind of expression, statement, or built-in function.
The release version number changes as frequently as bugs are fixed in the server code. Changes in the release number indicate changes that should only be visible to users as bug fixes, if at all.
=== help set_player_flag() ===========================
Syntax: set_player_flag (obj <object>, <value>) => none
If <value> is true, then <object> gains (or keeps) ``player object'' status: it will be an element of the list returned by `players()', the expression `is_player(<object>)' will return true, and users can connect to <object> by name when they log into the server.
If <value> is false, the <object> loses (or continues to lack) ``player object'' status: it will not be an element of the list returned by `players()', the expression `is_player(<object>)' will return false, and users cannot connect to <object> by name when they log into the server. In addition, if a user is connected to <object> at the time that it loses ``player object'' status, then that connection is immediately broken, just as if `boot_player(<object>)' had been called (see the description of `boot_player()' below).
=== help set_property_info() =========================
Syntax: property_info (obj <object>, str <prop-name>) => list
set_property_info (obj <object>, str <prop-name>, list <info>) => none
{<owner>, <perms>}where <owner> is an object and <perms> is a string containing only characters from the set `r', `w', and `c'. This is the kind of value returned by `property_info()' and expected as the third argument to `set_property_info()'; the latter function returns `E_INVARG' if <owner> is not valid or <perms> contains any illegal characters.
=== help set_task_perms() ==========================
Syntax: set_task_perms (obj <player>) => none
Note: This does not change the owner of the currently-running verb, only the permissions of this particular invocation. It is used in verbs owned by wizards to make themselves run with lesser (usually non-wizard) permissions.
=== help set_verb_args() ===========================
Syntax: verb_args (obj <object>, str <verb-name>) => list
set_verb_args (obj <object>, str <verb-name>, list <args>) => none
{<dobj>, <prep>, <iobj>}where <dobj> and <iobj> are strings drawn from the set `"this"', `"none"', and `"any"', and <prep> is a string that is either `"none"', `"any"', or one of the prepositional phrases listed much earlier in the description of verbs in the first chapter. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'. Note that for `set_verb_args()', <prep> must be only one of the prepositional phrases, not (as is shown in that table) a set of such phrases separated by `/' characters. `Set_verb_args()' returns `E_INVARG' if any of the <dobj>, <prep>, or <iobj> strings is illegal.
verb_args($container, "take") => {"any", "out of/from inside/from", "this"} set_verb_args($container, "take", {"any", "from", "this"})
=== help set_verb_code() ===========================
Syntax: verb_code (obj <object>, str <verb-name> [, <fully-paren> [,<indent>]]) => list
set_verb_code (obj <object>, str <verb-name>, list <code>) => list
If <object> is not valid, then `E_INVARG' is returned. If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned.
If the programmer does not have read (write) permission on the verb in question, then `verb_code()' (`set_verb_code()') returns `E_PERM'.
If the programmer is not, in fact, a programmer, then `E_PERM' is returned.
For `set_verb_code()', the result is a list of strings, the error messages generated by the MOO-code compiler during processing of <code>. If the list is non-empty, then `set_verb_code()' did not install <code>; the program associated with the verb in question is unchanged.
=== help set_verb_info() ===========================
Syntax: verb_info (obj <object>, str <verb-name>) => list
set_verb_info (obj <object>, str <verb-name>, list <info>) => none
{<owner>, <perms>, <names>}where <owner> is an object, <perms> is a string containing only characters from the set `r', `w', `x', and `d', and <names> is a string. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'; the latter function returns `E_INVARG' if <owner> is not valid or <perms> contains any illegal characters.
=== help setadd() =================================
Syntax: setadd (list <list>, <value>) => list
setremove (list <list>, <value>) => list
setadd({1, 2, 3}, 3) => {1, 2, 3} setadd({1, 2, 3}, 4) => {1, 2, 3, 4} setremove({1, 2, 3}, 3) => {1, 2} setremove({1, 2, 3}, 4) => {1, 2, 3} setremove({1, 2, 3, 2}, 2) => {1, 3, 2}
=== help setremove() ==============================
Syntax: setadd (list <list>, <value>) => list
setremove (list <list>, <value>) => list
setadd({1, 2, 3}, 3) => {1, 2, 3} setadd({1, 2, 3}, 4) => {1, 2, 3, 4} setremove({1, 2, 3}, 3) => {1, 2} setremove({1, 2, 3}, 4) => {1, 2, 3} setremove({1, 2, 3, 2}, 2) => {1, 3, 2}
=== help shutdown() ===============================
Syntax: shutdown (str <message>) => none
=== help sin() ====================================
Syntax: cos (FLOAT x) => FLOAT
sin (FLOAT x) => FLOAT
tan (FLOAT x) => FLOAT
=== help sqrt() ===================================
Syntax: sqrt (num <x>) => num
=== help strcmp() =================================
Syntax: trcmp (str <str1>, str <str2>) => num
=== help string_hash() =============================
Syntax: binary_hash (STR bin-string) => STR
string_hash (STR text) => STR
string_hash(x) == string_hash(y) then, almost certainly equal(x, y)This can be useful, for example, in certain networking applications: after sending a large piece of text across a connection, also send across the result of applying string_hash() to the text; if the destination site also applies string_hash() to the text and gets the same result, you can be quite confident that the large text has arrived unchanged.
=== help strsub() =================================
Syntax: strsub (str <subject>, str <what>, str <with> [, <case-matters>]) => str
strsub("%n is a fink.", "%n", "Fred") => "Fred is a fink." strsub("foobar", "OB", "b") => "fobar" strsub("foobar", "OB", "b", 1) => "foobar"
=== help substitute() ==============================
Syntax: substitute (str <template>, list <subs>) => str
In <template>, the strings `%1' through `%9' will be replaced by the text matched by the first through ninth parenthesized sub-patterns when `match()' or `rmatch()' was called. The string `%0' in <template> will be replaced by the text matched by the pattern as a whole when `match()' or `rmatch()' was called.
subs = match("*** Welcome to LambdaMOO!!!", "%(%w*%) to %(%w*%)"); substitute("I thank you for your %1 here in %2.", subs) => "I thank you for your Welcome here in LambdaMOO."
=== help suspend() ================================
Syntax: suspend (num <seconds>) => none
In some sense, this function forks the `rest' of the executing task.
However, there is a major difference between the use of `suspend(<seconds>)' and the use of the `fork (<seconds>)'. The `fork' statement creates a new task (a "forked task") while the currently-running task still goes on to completion, but a `suspend()' suspends the currently-running task (thus making it into a "suspended task"). This difference may be best explained by the following examples, in which one verb calls another:
.program #0:caller_A #0.prop = 1; #0:callee_A(); #0.prop = 2; . .program #0:callee_A fork(5) #0.prop = 3; endfork . .program #0:caller_B #0.prop = 1; #0:callee_B(); #0.prop = 2; . .program #0:callee_B suspend(5); #0.prop = 3; .Consider `#0:caller_A', which calls `#0:callee_A'. Such a task would assign 1 to `#0.prop', call `#0:callee_A', fork a new task, return to `#0:caller_A', and assign 2 to `#0.prop', ending this task. Five seconds later, if the forked task had not been killed, then it would begin to run; it would assign 3 to `#0.prop' and then stop. So, the final value of `#0.prop' (i.e., the value after more than 5 seconds) would be 3.
Now consider `#0:caller_B', which calls `#0:callee_B' instead of `#0:callee_A'. This task would assign 1 to `#0.prop', call `#0:callee_B', and suspend. Five seconds later, if the suspended task had not been killed, then it would resume; it would assign 3 to `#0.prop', return to `#0:caller', and assign 2 to `#0.prop', ending the task. So, the final value of `#0.prop' (i.e., the value after more than 5 seconds) would be 2.
A suspended task, like a forked task, can be described by the `queued_tasks()' function and killed by the `kill_task()' function. Suspending a task does not change its task id. A task can be suspended again and again by successive calls to `suspend()'.
Once `suspend()' has been used in a particular task, then the `read()' function will always return `E_PERM' in that task. For more details, see the description of `read()' below.
=== help task_id() ================================
Syntax: task_id () => num
=== help task_stack() ==============================
Syntax: task_stack (INT task-id [, include-line-numbers]) => LIST
=== help ticks_left() ===============================
Syntax: ticks_left () => num
seconds_left () => num
=== help time() ==================================
Syntax: time () => num
=== help tofloat() =================================
Syntax: tofloat (value) => FLOAT
tofloat(34) => 34.0 tofloat(#34) => 34.0 tofloat("34") => 34.0 tofloat("34.7") => 34.7 tofloat(E_TYPE) => 1.0
=== help toint() ==================================
Syntax: toint (<value>) => INT
tonum (<value>) => INT
toint(34.7) => 34 toint(-34.7) => 34 toint(#34) => 34 toint("34") => 34 toint("34.7") => 34 toint(" - 34 ") => -34 toint(E_TYPE) => 1
=== help toliteral() ================================
Syntax: toliteral (<value>) => STR
Examples: toliteral(43) => "43" toliteral(1.0/3.0) => "0.33333333333333" toliteral(#17) => "#17" toliteral(E_PERM) => "E_PERM" toliteral({"A", "B", {"C", 123}}) => "{\"A\", \"B\", {\"C\", 123}}"
=== help tonum() =================================
Syntax: tonum (<value>) => num
tonum(#34) => 34 tonum("34") => 34 tonum(" - 34 ") => -34 tonum(E_TYPE) => 1
=== help toobj() ==================================
Syntax: toobj (<value>) => obj
toobj("34") => #34 toobj("#34") => #34 toobj("foo") => #0 toobj({1, 2}) -error-> E_TYPE
=== help tostr() ==================================
Syntax: tostr (<value>, ...) => str
tostr(17) => "17" tostr(#17) => "#17" tostr("foo") => "foo" tostr({1, 2}) => "{list}" tostr(E_PERM) => "Permission denied" tostr("3 + 4 = ", 3 + 4) => "3 + 4 = 7"Note that `tostr()' does not do a good job of converting lists into strings; all lists, including the empty list, are converted into the string `"{list}"'.
=== help trunc() ==================================
Syntax: trunc (FLOAT <x>) => FLOAT
=== help typeof() =================================
Syntax: typeof (<value>) => num
if (typeof(x) == LIST) ... and not like this: if (typeof(x) == 3) ...because the former is much more readable than the latter.
=== help valid() ==================================
Syntax: valid (obj <object>) => num
valid(#0) => 1 valid(#-1) => 0
=== help value_bytes() =============================
Syntax: value_bytes(<value>) => INT
=== help value_hash() ==============================
Syntax: value_hash (<value>) => STR
=== help verb_args() ===============================
Syntax: verb_args (obj <object>, str <verb-name>) => list
set_verb_args (obj <object>, str <verb-name>, list <args>) => none
{<dobj>, <prep>, <iobj>}where <dobj> and <iobj> are strings drawn from the set `"this"', `"none"', and `"any"', and <prep> is a string that is either `"none"', `"any"', or one of the prepositional phrases listed much earlier in the description of verbs in the first chapter. This is the kind of value returned by `verb_info()' and expected as the third argument to `set_verb_info()'. Note that for `set_verb_args()', <prep> must be only one of the prepositional phrases, not (as is shown in that table) a set of such phrases separated by `/' characters. `Set_verb_args()' returns `E_INVARG' if any of the <dobj>, <prep>, or <iobj> strings is illegal.
verb_args($container, "take") => {"any", "out of/from inside/from", "this"} set_verb_args($container, "take", {"any", "from", "this"})
=== help verb_code() ==============================
Syntax: verb_code (obj <object>, str <verb-name> [, <fully-paren> [, <indent>]]) => list
set_verb_code (obj <object>, str <verb-name>, list <code>) => list
If <object> is not valid, then `E_INVARG' is returned. If <object> does not define a verb named <verb-name>, then `E_VERBNF' is returned. If the programmer does not have read (write) permission on the verb in question, then `verb_code()' (`set_verb_code()') returns `E_PERM'. If the programmer is not, in fact, a programmer, then `E_PERM' is returned.
For `set_verb_code()', the result is a list of strings, the error messages generated by the MOO-code compiler during processing of <code>.
If the list is non-empty, then `set_verb_code()' did not install <code>; the program associated with the verb in question is unchanged.
=== help verb_info() ===============================
Syntax: verb_info (obj <object>, str <verb-name>) => list
set_verb_info (obj <object>, str <verb-name>, list <info>) => none
=== help verbs() ==================================
Syntax: verbs (obj <object>) => list