MongooseA text-based world full of questionable inventions.

All help topics · Link to this topic

Showing help on '$code_utils'

code utilities ($code_utils #59)

parse_propref("foo.bar") => {"foo","bar"} (or 0 if arg. isn't a property ref.)
parse_verbref("foo:bar") => {"foo","bar"} (or 0 if arg. isn't a verb ref.)
parse_argspec("any","in","front","of","this","baz"...)
=> {{"any", "in front of", "this"},{"baz"...}}
(or string if args don't parse)

toint(string) => integer (or E_TYPE if string is not a integer)
toobj(string) => object (or E_TYPE if string is not an object)
toerr(number or string) => error value (or 1 if out of range or unrecognized)
error_name(error value) => name of error (e.g., error_name(E_PERM) => "E_PERM")

verb_perms() => the current task_perms (as set by set_task_perms()).
verb_location() => the object where the current verb is defined.
verb_frame() => callers()-style frame for the current verb.
verb_all_frames() => entire callers() stack including current verb.
verb_usage([object,verbname]) => returns first line of verb doc, usually usage
verb_documentation([object,verbname]) => documentation at beginning of
verb code, if any -- default is the calling verb
set_verb_documentation(object,verbname,text) => sets text at beginning of verb

Preposition routines

prepositions() => full list of prepostions
full_prep ("in") => "in/inside/into"
short_prep("into") => "in"
short_prep("in/inside/into") => "in"
get_prep ("off", "of", "the", "table") => {"off of", "the", "table"}

Verb routines

verbname_match (fullname,name) => can `name' be used to call `fullname'
find_verb_named (object,name[,n]) => verb number or 0 if not found
find_last_verb_named (object,name[,n]) => verb number of last verb match
find_callable_verb_named (object,name[,n]) => verb number or 0 if not found
find_verbs_containing (pattern[,object|objlist]) => does work for @grep
find_verbs_matching (pattern[,object|objlist]) => does work for @egrep
move_verb (from obj,name,to obj[,newname]) => move a verb from object to object

move_prop (from obj,name,to obj[,newname]) => move a property to another object

Verbs that do the actual dirty work for command lines verbs:

@show => show_object (object)
show_property(object,propname)
show_verbdef (object,verbname)
explain_syntax => explain_verb_syntax(thisname,verbname,@verbargs)
eval*-d => eval_d(code)
help => help_db_list([player])
help_db_search(string topic, dblist)
@who => show_who_listing(players [,more_players])
@check-full => display_callers([callers() output])
@dump => dump_preamble(object)
=> dump_properties(object, create_flag)
=> dump_verbs(object, create_flag)

Random but useful verbs

verb_or_property(object,name[,@args]) => result of verb or property call,
or E_PROPNF
corify_object(object) => if the object is corified, returns $<name>
task_valid(INT task_id) => returns true if task_id is currently running.
task_owner(INT task_id) => returns owner of task_id, if running
owns_task(NUM task_id,OBJ who) => returns whether who owns task_id (if running)
argstr(verb,args[,argstr] => returns a corrected argstr (see full verb help)
substitute(string,subs) => subs in form {{"target", "sub"}, {...}, ...}

:toint(STR)
:toobj(objectid as string) => objectid
:toerr - toerr(n), toerr("E_FOO"), toerr("FOO") => E_FOO.
:error_name - error_name(E_FOO) => "E_FOO"
:verb_p*erms - returns the permissions of the current verb (either the owner or the result of the most recent set_task_perms()).
:verb_loc*ation - returns the object where the current verb is defined.
:verb_documentation([object,verbname]) => documentation at beginning of verb code, if any
:set_verb_documentation(object,verbname,text)
:parse_propref - $code_utils:parse_propref(string)
:parse_verbref - $code_utils:parse_verbref(string)
:parse_arg_spec(@args)
:short_prep(p) => shortest preposition equivalent to p
:get_prep(@args) extracts the prepositional phrase from the front of args, returning a list consisting of the preposition (or "", if none) followed by the unused args.
:find_verb_named(object,name[,n])
:find_last_verb_named(object,name[,n])
:find_callable_verb_named(object,name[,n])
:verbname_match(fullverbname,name) => TRUE iff `name' is a valid name for a verb with the given `fullname'
:find_verbs_containing - $code_utils:find_verbs_containing(pattern[,object|object-list[,casematters]])
:_find_verbs_containing(pattern,object[,casematters])
:_grep_verb_code(pattern,object,verbname[,casematters]) => line number or 0
:_egrep_verb_code(regexp,object,verbname[,casematters]) => 0 or line number
:_parse_audit_args - Parse [from <start>] [to <end>] [for <name>].
:help_db_list([player]) => list of help dbs
:help_db_search(string,dblist)
:corify_object(object) => string representing object
:inside_quotes - See if the end of the string passed as args[1] ends 'inside' a doublequote.
:verb_or_property - verb_or_property(<obj>, <name> [, @<args>])
:task_valid - task_valid(INT id)
:task_owner(INT task_id) => returns the owner of the task belonging to the id.
:argstr(verb,args[,argstr]) => what argstr should have been.
:verbname_match(fullverbname,name) => TRUE iff `name' is a valid name for a verb with the given `fullname'
:substitute - $code_utils:substitute(string,subs) => new line
:_egrep_verb_code_all(regexp,object,verbname) => list of lines number
:_grep_verb_code_all(pattern,object,verbname[,casematters]) => list of lines
:verb_usage([object,verbname]) => usage string at beginning of verb code, if any
:verb_frame - returns the callers() frame for the current verb.
:verb_all_frames - returns {this:verb_frame(), @callers()}.
:move_verb(OBJ from, STR verb name, OBJ to, [STR new verb name]) -> Moves the specified verb from one object to another. Returns {OBJ, Full verb name} where the verb now resides if successful, error if not. To succeed, caller_perms() must control both objects and own the verb, unless called with wizard perms. Supplying a fourth argument moves the verb to a new name.
:move_prop(OBJ from, STR prop name, OBJ to, [STR new prop name]) -> Moves the specified property and its contents from one object to another. Returns {OBJ, property name} where the property now resides if successful, error if not. To succeed, caller_perms() must control both objects and own the property, unless called with wizard perms. Supplying a fourth argument gives the property a new name on the new object.
:eval_d_util - Do not remove this verb! This is an auxiliary verb for :eval_d().
:display_callers([callers() style list]) - displays the output of the given argument, assumed to be a callers() output. See `help callers()' for details. Will use callers() explicitly if no argument is passed.
:callers_text([callers() style list]) - returns the output of the given argument, assumed to be a callers() output. See `help callers()' for details. Will use callers() explicitly if no argument is passed.
:set_property_value(object, property, value)
:owns_task - $code_utils:owns_task(task_id, who)
:dflag_on - Syntax: $code_utils:dflag_on() => 0|1
:type_str - type_str -- returns a string describing the type of args[1]
:dump_properties (object, create_flag): returns the list of strings representing the property information for this object and its ancestor objects in @dump format.
:dump_preamble(object): produces the @create command necessary to dump this object.
:dump_verbs (object, create_flag): returns the list of strings representing the verb information for this object in @dump format.
:_find_verb_lines_containing(pattern,object[,casematters])
:format_traceback - Usage: :format_traceback(exception)
:_format_traceback_frame - Usage: :_format_traceback_frame(frame)
:commentify - Usage: commentify(lines)
:uncommentify - Usage: uncommentify(lines)
:tofloat(STR)
:verb_parameters([object,verbname]) => verb parameters if any
:rank_util_usage([target=$utils][, limit=40][, maxscan=0]) => {{count, verbname}, ...} sorted desc. Approximate caller ranking: scans every verb body in the DB once, tallying ':name' references against the set of verb names defined on descendants of 'target'. Heuristic (over-counts shared names). maxscan>0 caps the object range (for quick tests). Wizard only.
:temporary_eval_verb - Do not remove this verb! This is an auxiliary verb for :eval_d() and friends.

Also from $generic_utils: 1 documented verb. help $generic_utils