===== help $lock_utils ==============================
lock utilities (#53):
----
lock utilities (#53) [ readable ]
Owned by ScarFace (#2).
Child of Generic Utilities Package (#79).
#53:canonicalize_spaces #53:eval_key #53:eval_key_new
#53:init_scanner #53:match_object #53:parse_A
#53:parse_A_new #53:parse_E #53:parse_keyexp
#53:scan_token #53:unparse_key
These routines are used when locking objects, and when testing an object's lock before allowing use (such as in an exit).
:parse_keyexp (string keyexpression, object player)
=> returns an object or list for the new key as defined by the
keyexpression or a string describing the error if it failed.
:eval_key (LIST|OBJ key, testobject)
=> returns true if the given testobject satisfies the key.
:unparse_key (LIST|OBJ key)
=> returns a string describing the key in english/moo-code terms.
For more information on keys and locking, read `help locking', `help keys', and `help @lock'.
help #53:eval_key
Information about lock utilities(#53):eval_key
----
eval_key(LIST|OBJ coded key, OBJ testobject) => returns true if testobject will solve the provided key.
help #53:match_object
Information about lock utilities(#53):match_object
----
used by $lock_utils to unparse a key expression so one can use `here' and `me' as well as doing the regular object matching.
help #53:parse_keyexp
Information about lock utilities(#53):parse_keyexp
----
parse_keyexp(STRING keyexpression, OBJ player) => returns a list containing the coded key, or a string containing an error message if the attempt failed.
Grammar for key expressions:
E ::= A | E || A | E && A A ::= ( E ) | ! A | object | ? object
===== help $match_utils ============================
matching utilities (#51):
----
matching utilities (#51) [ readable ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
#51:match #51:match_list
#51:match_nth #51:match_verb
#51:object_match_failed #51:"parse_ordinal_reference parse_ordref"
#51:parse_possessive_reference
This is the Generic Utility Object. One presumes it should have text in it explaining the use of the utility object in question.
help #51:match
Information about matching utilities(#51):match
----
:match(string, object-list)
Return object in 'object-list' aliased to 'string'.
Matches on a wide variety of syntax, including:
"5th axe" -- The fifth object matching "axe" in the object list.
"where's sai" -- The only object contained in 'where' matching "sai" (possible $ambiguous_match).
"where's second staff" -- The second object contained in 'where' matching
"staff".
"my third dagger" -- The third object in your inventory matching "dagger".
Ordinal matches are determined according to the match's position in
'object-list' or, if a possessive (such as "where" above) is given, then the
ordinal is the nth match in that object's inventory.
In the matching room (#3879@LambdaMOO), the 'object-list' consists of first the player's contents, then the room's, and finally all exits leading from the room.
help #51:match_list
Information about matching utilities(#51):match_list
----
:match_list(string, object_list) -> List of all matches.
help #51:match_nth
Information about matching utilities(#51):match_nth
----
:match_nth(string, objlist, n)
Find the nth object in 'objlist' that matches 'string'.
help #51:match_verb
Information about matching utilities(#51):match_verb
----
$match_utils:match_verb(verbname, object) => Looks for a command-line style
verb named <verbname> on <object> with current values of prepstr, dobjstr, dobj, iobjstr, and iobj. If a match is made, the verb is called with @args[3] as arguments and 1 is returned. Otherwise, 0 is returned.
help #51:object_match_failed
Information about matching utilities(#51):object_match_failed
----
Usage: object_match_failed(object, string[, ambigs])
Prints a message if string does not match object. Generally used after object is derived from a :match_object(string).
ambigs is an optional list of the objects that were matched upon. If given, the message printed will list the ambiguous among them as choices.
help #51:parse_ordinal_reference
Information about matching utilities(#51):parse_ordinal_reference/parse_ordref
----
:parse_ordref(string)
Parses strings referring to an 'nth' object.
=> {NUM n, STR object} Where 'n' is the number the ordinal represents, and 'object' is the rest of the string.
=> 0 If the given string is not an ordinal reference.
Example:
:parse_ordref("second broadsword") => {2, "broadsword"}
:parse_ordref("second") => 0
Note that there must be more to the string than the ordinal alone.
help #51:parse_possessive_reference
Information about matching utilities(#51):parse_possessive_reference
----
:parse_possessive_reference(string)
Parses strings in a possessive format.
=> {STR whose, STR object} Where 'whose' is the possessor of 'object'.
If the string consists only of a possessive string (ie: "my", or "yduJ's"),
then 'object' will be an empty string.
=> 0 If the given string is not a possessive reference.
Example:
:parse_possessive_reference("joe's cat") => {"joe", "cat"}
:parse_possessive_reference("sis' fish") => {"sis", "fish"}
Strings are returned as a value suitable for a :match routine, thus 'my'
becoming 'me'.
:parse_possessive_reference("my dog") => {"me", "dog"}
===== help $Math_Utils ============================
Math Utilities (#27):
----
Math Utilities (#27) [ readable ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
Trigonometric/Exponential functions:
sin(a),cos(a),tan(a) -- returns 10000*(the value of the corresponding trigonometric function) angle a is in degrees. arctan([x,]y) -- returns arctan(y/x) in degrees in the range -179..180. x defaults to 10000. Quadrant is that of (x,y). exp(x[,n]) -- calculates e^x with an nth order taylor polynomialStatistical functions:
combinations(n,r) -- returns the number of combinations given n objects taken r at a time. permutations(n,r) -- returns the number of permutations possible given n objects taken r at a time.Number decomposition:
div(n,d) -- correct version of / (handles negative numbers correctly) mod(n,d) -- correct version of % (handles negative numbers correctly) divmod(n,d) -- {div(n,d),mod(n,d)} parts(n,q[,i]) -- returns a list of two elements {integer,decimal fraction}Other math functions:
sqrt(x) -- returns the largest integer n <= the square root of x pow(x,n) -- returns x^n factorial(x) -- returns x!Series:
fibonacci(n) -- returns the 1st n fibonacci numbers in a list geometric(x,n) -- returns the value of the nth order geometric series at xInteger Properties:
gcd(a,b) -- find the greatest common divisor of the two numbers lcm(a,b) -- find the least common multiple of the two numbers are_relatively_prime(a,b) -- return 1 if a and b are relatively prime is_prime(n) -- returns 1 if the number is a prime and 0 otherwiseMiscellaneous:
random(n) -- returns a random number from 0..n if n > 0 or n..0 if n < 0 random_range(n[,mean]) -- returns a random number from mean - n..mean + n with mean defaulting to 0 simpson({a,b},{f(a),f((a+b)/2),f(b)}) -- returns the numerical approximation of an integral using simpson's ruleBitwise Arithmetic:
AND(x,y) -- returns x AND y OR(x,y) -- returns x OR y XOR(x,y) -- returns x XOR y (XOR is the exclusive-or function) NOT(x) -- returns the complement of x All bitwise manipulation is of 32-bit values.
===== help $object_utils ============================
object utilities (#52):
----
object utilities (#52) [ readable ]
Owned by ScarFace (#2).
Child of Generic Utilities Package (#79).
#52:all_contents #52:all_properties
#52:all_properties_suspended #52:all_verbs #52:ancestors
#52:branches #52:branches_suspended #52:connected
#52:contains #52:defines_verb #52:"descendants descendents"
#52:"descendants_suspended descendents_suspended"
#52:descendants_with_property_suspended
#52:findable_properties #52:has_callable_verb
#52:has_property #52:has_verb
#52:isa #52:isoneof #52:leaves
#52:leaves_suspended #52:locations #52:match_verb
#52:ordered_descendants #52:owned_properties #52:property_conflicts
These routines are useful for finding out information about individual objects.
Examining everything an object has defined on it:
all_verbs (object) => like it says all_properties (object) => likewise findable_properties(object) => tests to see if caller can "find" them owned_properties (object[, owner]) => tests for ownershipInvestigating inheritance:
ancestors(object[,object...]) => all ancestors descendants (object) => all descendants ordered_descendants(object) => descendants, in a different order leaves (object) => descendants with no children branches (object) => descendants with children isa (object,class) => true iff object is a descendant of class (or ==) property_conflicts (object,newparent) => can object chparent to newparent? isoneof (object,list) => true if object :isa class in list of parentsConsidering containment:
contains (obj1, obj2) => Does obj1 contain obj2 (nested)? all_contents (object) => return all the (nested) contents of object locations (object) => list of location hierarchy above objectVerifying verbs and properties:
has_property(object,pname) => false/true according as object.(pname) exists has_verb (object,vname) => false/{#obj} according as object:(vname) exists has_callable_verb => same, but verb must be callable from a program defines_verb => does this object *define* this verb match_verb (object,vname) => false/{location, newvname} (identify location and usable name of verb)Player checking:
connected (object) => true if object is a player and is connectedSuspending:
Many of the above verbs have ..._suspended versions to assist with very large object hierarchies.
The following exist: descendants_suspended branches_suspended leaves_suspended all_properties_suspended descendants_with_property_suspended
===== help $perm_utils =============================
Generic Utilities Package (#42):
----
Generic Utilities Package (#42) [ readable ]
Owned by ScarFace (#2).
Child of Generic Utilities Package (#79).
#42:apply #42:caller
#42:controls #42:"controls_prop controls_property"
#42:password_ok
Miscellaneous routines for permissions checking
For a complete description of a given verb, do `help $perm_utils:verbname'
:controls(who,what) -- can who write on object what :controls_property(who,what,propname) -- can who write on what.propname These routines check write flags and also the wizardliness of `who'. (these last two probably belong on $code_utils) :apply(permstring,mods) -- used by @chmod to apply changes (e.g., +x) to a given permissions string :caller() -- returns the first caller in the callers() stack distinct from `this'
===== help $seq_utils ===============================
sequence utilities (#34):
----
sequence utilities (#34) [ readable ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
A sequence is a set of integers (*)
This package supplies the following verbs:
:add (seq,f,t) => seq with [f..t] interval added :remove (seq,f,t) => seq with [f..t] interval removed :range (f,t) => sequence corresponding to [f..t] {} => empty sequence :contains (seq,n) => n in seq :size (seq) => number of elements in seq :first (seq) => first integer in seq or E_NONE :firstn (seq,n) => first n integers in seq (as a sequence) :last (seq) => last integer in seq or E_NONE :lastn (seq,n) => last n integers in seq (as a sequence) :complement(seq) => sequence consisting of integers not in seq :union (seq,seq,...) => union of all sequences :intersect(seq,seq,...) => intersection of all sequences :contract (seq,cseq) (see `help $seq_utils:contract') :expand (seq,eseq[,include]) (see `help $seq_utils:expand') :extract(seq,array) => array[@seq] :for([n,]seq,obj,verb,@args) => for s in (seq) obj:verb(s,@args); endfor :tolist(seq) => list corresponding to seq :tostr(seq) => contents of seq as a string :from_list(list) => sequence corresponding to list :from_sorted_list(list) => sequence corresponding to list (assumed sorted) :from_string(string) => sequence corresponding to stringFor boolean expressions, note that the representation of the empty sequence is {} (boolean FALSE) and all non-empty sequences are represented as nonempty lists (boolean TRUE).
The representation used works better than the usual list implementation for sets consisting of long uninterrupted ranges of integers.
For sparse sets of integers the representation is decidedly non-optimal (though it never takes more than double the space of the usual list representation).
(*) i.e., integers in the range [$minint+1..$maxint]. The implementation depends on $minint never being included in a sequence.
i if i < f1 i-(a1-f1) if a1 <= i < f2 i-(a1-f1+a2-f2) if a2 <= i < f3 ...returning the resulting sequence. For any finite sequence cseq, the following always holds:
i if i < f1 i+(a1-f1) if f1 <= i < f2-(a1-f1) i+(a1-f1+a2-f2) if f2-(a1-f1) <= i < f3-(a2-f2)-(a1-f1)... returning the resulting sequence if include=0,
===== help $set_utils ===============================
Set Utilities (#28):
----
Set Utilities (#28) [ readable ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
#28:contains #28:diff*erence
#28:"difference_suspended diff_suspended" #28:equal
#28:"exclusive_or xor" #28:intersection
#28:intersection_preserve_case #28:union
This object is useful for operations that treat lists as sets (i.e.,
without concern about order and assuming no duplication).
union(set, set, ...) => union
intersection(set, set, ...) => intersection
intersection_preserve_case(base set, set, set, ...)
=> intersection with the case of the base set's elements preserved
diff*erence(set1, set2, ..., setn)
=> result of removing all elements of sets 2..n from set 1.
exclusive_or(set, set, set, ...)
=> all elements that are contained in exactly one of the sets
contains(set1, set2, ..., setn)
=> true if and only if all of sets 2..n are subsets of set 1
equal(set1, set2)
=> true if and only if set1 and set2 are equal
help #28:contains
Information about Set Utilities(#28):contains
----
True if the first list given is a superset of all subsequent lists.
False otherwise. {} is a superset of {} and nothing else; anything is
a superset of {}. If only one list is given, return true.
help #28:difference
Information about Set Utilities(#28):diff*erence
----
Usage: diff(set 1, set 2, ..., set n)
Returns all elements of set 1 that are not in sets 2..n
help #28:difference_suspended
Information about Set Utilities(#28):difference_suspended/diff_suspended
----
Usage: diff(set 1, set 2, ..., set n)
Returns all elements of set 1 that are not in sets 2..n
help #28:equal
Information about Set Utilities(#28):equal
----
True if the two lists given contain the same elements.
False otherwise.
help #28:exclusive_or
Information about Set Utilities(#28):exclusive_or/xor
----
Usage: exclusive_or(set, set, ...)
Return the set of all elements that are in exactly one of the input sets
For two sets, this is the equivalent of (A u B) - (A n B).
help #28:intersection
Information about Set Utilities(#28):intersection
----
Returns the set intersection of all the lists provided as arguments.
help #28:intersection_preserve_case
Information about Set Utilities(#28):intersection_preserve_case
----
Copied from Fox (#54902):intersection Mon Dec 27 17:02:57 1993 PST
a version of $set_utils:intersection that maintains the property that
everything in the return value is in the first argument, even considering
case
help #28:union
Information about Set Utilities(#28):union
----
Returns the set union of all of the lists provided as arguments.