===== help $command_utils ==========================
Generic Utilities Package (#56):
----
Generic Utilities Package (#56) [ readable ]
Owned by ScarFace (#2).
Child of Generic Utilities Package (#79).
#56:do_huh #56:do_huh(old) #56:dump_lines
#56:explain_syntax #56:init_for_core #56:object_match_failed
#56:"player_match_result player_match_failed" #56:read
#56:read_lines #56:read_lines_escape #56:running_out_of_time
#56:suspend #56:suspend_database_add #56:suspend_database_cleanup
#56:suspend_database_display #56:suspend_database_info #56:suspend_database_remove
#56:suspend_if_needed #56:task_info #56:yes_or_no
$command_utils is the repository for verbs that are of general usefulness to authors of all sorts of commands. For more details about any of these verbs, use `help $command_utils:<verb-name>'.
Detecting and Handling Failures in Matching
-------------------------------------------
:object_match_failed(match_result, name) Test whether or not a :match_object() call failed and print messages if so. :player_match_failed(match_result, name) Test whether or not a :match_player() call failed and print messages if so. :player_match_result(match_results, names) ...similar to :player_match_failed, but does a whole list at once.Reading Input from the Player
:read() -- Read one line of input from the player and return it. :yes_or_no([prompt]) -- Prompt for and read a `yes' or `no' answer. :read_lines() -- Read zero or more lines of input from the player. :dump_lines(lines) -- Return list of lines quoted so that feeding them to :read_lines() -- will reproduce the original lines.Utilities for Suspending
:running_out_of_time() -- Return true if we're low on ticks or seconds. :suspend_if_needed(time) -- Suspend (and return true) if we're running out of time.Client Support for Lengthy Commands
:suspend(args) -- Handle PREFIX and SUFFIX for clients in long commands.
An optional 3rd arg gives an identifying string to prefix to each of the nasty messages.
Returns E_PERM if the current task is not a command task that has never called suspend().
========== Alterado para aceitar clientes java ==============
Returns a list of strings, the (up to MAX, if given) lines typed by the player. Returns E_PERM if the current task is not a command task that has never called suspend().
In order that one may enter arbitrary lines, including "@abort" or ".", if the first character in an input line is `.' and there is some nonwhitespace afterwords, the `.' is dropped and the rest of the line is taken verbatim, so that, e.g., ".@abort" enters as "@abort" and ".." enters as ".".
Similar to :read_lines() except that help is available and one may specify other escape sequences to terminate the read. escapes should be either a string or list of strings; this specifies which inputs other from `.' or `@abort' should terminate the read (... don't use anything beginning with a `.'). help should be a string or list of strings to be printed in response to the player typing `?'; the first line of the help text should be a general comment about what the input text should be used for.
Successive lines should describe the effects of the alternative escapes.
Returns {end,list-of-strings-input} where end is the particular line that terminated this input or 0 if input terminated normally with `.'. Returns
E_PERM if the current task is not a command task that has never called suspend().
@abort and lines beginning with `.' are treated exactly as with :read_lines()
Proper usage:
The first time you want to suspend, use output_delimiters = $command_utils:suspend(time, x); where x is some non-zero number.
Following, use $command_utils:suspend(time, output_delimiters);
To wrap things up, use $command_utils:suspend(time, output_delimiters[2]);
You'll probably want time == 0 most of the time.
Note: Using this from verbs called by other verbs could get pretty weird.
Returns E_NONE if the player enters a blank line, E_INVARG, if the player enters something that isn't a prefix of "yes" or "no", and E_PERM if the current task is not a command task that has never called suspend().
===== help $gender_utils ============================
Gender_Utilities (#41):
----
Gender_Utilities (#41) [ readable ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
#41:add #41:_do #41:get_conj*ugation
#41:get_pronoun #41:pronoun_sub #41:set
#41:_verb_plural #41:_verb_singular
Defines the list of standard genders, the default pronouns for each, and routines for adding or setting pronoun properties on any gendered object.
Properties:
.genders -- list of standard genders
.pronouns -- list of pronoun properties
.ps .po .pp .pq .pr .psc .poc .ppc .pqc .prc
-- lists of pronouns for each of the standard genders
If foo is of gender this.gender[n], then the default pronoun foo.p is
this.p[n] (where p is one of ps/po/pp/pq...)
Verbs:
:set(object,newgender) -- changes pronoun properties to match new gender.
:add(object[,perms[,owner]]) -- adds pronoun properties to object.
:get_pronoun (which,object) -- return pronoun for a given object
:get_conj*ugation(verbspec,object) -- return appropriately conjugated verb
help #41:add
Information about Gender_Utilities(#41):add
----
$gender_utils:add(object[,perms[,owner]])
--- adds pronoun properties to object if they're not already there.
perms default to "rc", owner defaults to the object owner.
help #41:_do
Information about Gender_Utilities(#41):_do
----
_do(cap,object,modifiers...)
help #41:get_conjugation
Information about Gender_Utilities(#41):get_conj*ugation
----
get_conj(verbspec,object) => verb conjugated according to object.
verbspec can be one of "singular/plural", "singular", "singular/", or "/plural", e.g., "is/are", "is", "is/", or "/are".
The object is checked to see whether it is singular or plural. This is
inferred from its .gender property. If .gender doesn't exist or the object itself is invalid, we assume singular.
help #41:get_pronoun
Information about Gender_Utilities(#41):get_pronoun
----
get_pronoun(key,object) => pronoun corresponding to object.
key can be one of s,o,p,q,r,S,O,P,Q,R to refer to the pronoun properties relatively directly or it can be something of the form "he/she" or "He/She".
Next the object is checked for the desired pronoun property. If that doesn't exist, we look at object.gender and infer the pronoun from the corresponding $gender_utils property. If .gender doesn't exist or the object itself is invalid, we use the corresponding property on $player.
help #41:pronoun_sub
Information about Gender_Utilities(#41):pronoun_sub
----
Experimental pronoun substitution. The official version is on $string_utils.
syntax: :pronoun_sub(text[,who])
experimental version that accomodates Aladdin's style...
help #41:set
Information about Gender_Utilities(#41):set
----
$gender_utils:set(object,gender) --- sets the pronoun properties of object. gender is a string: one of the strings in $gender_utils.genders, the list of recognized genders. If the gender change is successful, the (full) name of the gender (e.g., "male") is returned. E_NONE is returned if gender does not match any recognized gender. Any other error encountered (e.g., E_PERM, E_PROPNF) is likewise returned and the object's pronoun properties are left unaltered.
===== help $ghblu_utils ============================
ghblu (#14):
----
Generic BigList Utilities
----------------------------
ghblu (#14) [ readable fertile ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
#14:25 ** unreadable ** #14:debug
#14:delete_range #14:_extract #14:extract_range
#14:find_nth #14:_find_nth #14:find_ord
#14:_find_ord #14:"insert_after insert_before"
#14:_insertfirst #14:insert_last
#14:keep_range #14:kill
#14:length #14:_listfind_nth #14:_merge
#14:next #14:_rmerge #14:_scrunch
#14:set_nth #14:_set_nth #14:_skill
#14:_smerge #14:_split #14:start
This is a package for maintaining huge persistent (sorted) lists in a format that is less likely to spam the server (which runs into a certain amount of trouble dealing with long ordinary lists --- btw we use `biglist' to refer to the huge data structure we're about to describe and `list' to refer to ordinary MOO lists {...}). The biglist in question lives on a particular object, to which we will refer in the discussion below as the `home' object, and its various elements appear as leaves of a tree whose nodes are kept in properties of the home object. It should be noted that the home object does not need to be (and in fact should *not* be) a descendant of this one; this object merely provides utilities for manipulating the properties on the home object that are used in a particular biglist manipulation.
All of the utilities below refer to `caller' to locate the home object. Thus verbs to manipulate a given biglist must be located on or inherited by its home object itself. The home object needs to define the following verbs
:_make(@args) => new property on home object with value args
:_kill(prop) delete a given property that was created by :_make
:_get(prop) => home.prop
:_put(prop,@args) set home.prop = args
:_ord(element) given something that is of the form of a biglist element
return the corresponding ordinal (for sorting purposes).
If you never intend to use :find_ord, then this can be a routine that always returns 0 or some other random value.See #5546 (Generic Biglist Resident) or $big_mail_recipient for examples.
Those of the following routines that take a biglist argument are expecting either {} (empty biglist) or some biglist returned by one of the other routines
:length(biglist) => length(biglist) (i.e., number of elements)
:find_nth(biglist,n) => biglist[n]
:find_ord(biglist,k,comp) => n where n is the largest such that
home:(comp)(k,home:_ord(biglist[n])) is false, or the smallest such that
home:(comp)(k,home:_ord(biglist[n+1])) is true.
Always returns a value between 0 and length(biglist) inclusive. :start(biglist,s,e) => {biglist[s..?],@handle} or {}
:next(@handle) => {biglist[?+1..??],@newhandle} or {}
These two are used for iterating over a range of elements of a biglist
for elt in (biglist[first..last])
...
endfor
is
handle = :start(biglist,first,last);
while(handle)
for elt in (handle[1])
...
endfor
handle = :next(@listdelete(handle,1));
endwhile
The following all destructively modify their biglist argument(s) L (and M).
:set_nth(L,n,value) => L[n] = value
replaces the indicated element
:insert_before(L,M,n) => {@L[1..n-1],@M,@L[n..length(L)]}
:insert_after (L,M,n) => {@L[1..n], @M,@L[n+1..length(L)]}
takes two distinct biglists, inserts one into the other at the given point
returns the resulting consolidated biglist
:extract_range(L,m,n) => {{@L[1..m-1],@L[n+1..]}, L[m..n]}
breaks the given biglist into two distinct biglists.
:delete_range(L,m,n[,leafkiller]) => {@L[1..m-1],@L[n+1..]}
:keep_range (L,m,n[,leafkiller]) => L[m..n]
like extract_range only we destroy what we don't want.
:insertlast(L,value) => {@L,value}
inserts a new element at the end of biglist.
If find_ord is to continue to work properly, it is assumed that the home:_ord(elt) is greater (comp-wise) than all of the :_ord values of elements currently in the biglist.
:kill(L[,leafkiller])
destroys all nodes used by biglist.
Calls home:leafkiller on each element.
===== help $list_utils ===============================
list_utilities (#55):
----
list_utilities (#55) [ readable ]
Owned by Hacker (#37).
Child of Generic Utilities Package (#79).
append (list,list,..) => result of concatenating the given lists
reverse (list) => reversed list
remove_duplicates (list) => list with all duplicates removed
compress (list) => list with consecutive duplicates removed
setremove_all (list,elt) => list with all occurrences of elt removed
find_insert (sortedlist,e) => index of first element > e in sorted list
sort (list[,keys]) => sorted list
count (elt,list) => count of elt found in list.
flatten (list) => flatten all recursive lists into one list
make (n[,e]) => list of n copies of e
range (m,n) => {m,m+1,...,n}
arrayset (list,val,i[,j,k...]) => array modified so that list[i][j][k]==val
-- Mapping functions (take a list and do something to each element):
map_prop ({o...},prop) => list of o.(prop) for all o
map_verb ({o...},verb[,args) => list of o:(verb)(@args) for all o
map_arg ([n,]obj,verb,{a...},args) => list of obj:(verb)(a,@args) for all a
-- Association list functions --
An association list (alist) is a list of pairs (2-element lists), though the following functions have been generalized for lists of n-tuples (n-element lists). In each case i defaults to 1.
assoc (targ,alist[,i]) => 1st tuple in alist whose i-th element is targ iassoc (targ,alist[,i]) => index of same. assoc_prefix (targ,alist[,i]) => ... whose i-th element has targ as a prefix iassoc_prefix(targ,alist[,i]) => index of same. slice (alist[,i]) => list of i-th elements sort_alist (alist[,i]) => alist sorted on i-th elements.