Feature Object for Maybe Useful Stuff. All ported.
     At this point, @find #xxx works. The others have some weird stuff going on.
"'find_verb ()' - Search for a verb with the given name. The objects searched
are those returned by this:find_verbs_on(). The printing order relies on $list_utils:remove_duplicates
to leave the *first* copy of each duplicated element in a list; for example, {1,
2, 1} -> {1, 2}, not to {2, 1}.";
name = args[1];
results = "";
objects = $list_utils:remove_duplicates(this:find_verbs_on());
for thing in (objects)
if (valid(thing) && (mom = $object_utils:has_verb(thing, name)))
results = ((((results + " ") + thing.name) + "(") + tostr(thing)) + ")";
mom = mom[1];
if (thing != mom)
results = ((((results + "--") + mom.name) + "(") + tostr(mom)) + ")";
endif
endif
endfor
if (results)
this:tell("The verb :", name, " is on", results);
else
this:tell("The verb :", name, " is nowhere to be found.");
endif
.
find_property:
"'find_property ()' - Search for a property with the given name. The objects
searched are those returned by this:find_properties_on(). The printing order relies
on $list_utils:remove_duplicates to leave the *first* copy of each duplicated element
in a list; for example, {1, 2, 1} -> {1, 2}, not to {2, 1}.";
name = args[1];
results = "";
objects = $list_utils:remove_duplicates(this:find_properties_on());
for thing in (objects)
if (valid(thing) && (mom = $object_utils:has_property(thing, name)))
results = ((((results + " ") + thing.name) + "(") + tostr(thing)) + ")";
mom = this:property_inherited_from(thing, name);
if (thing != mom)
if (valid(mom))
results = ((((results + "--") + mom.name) + "(") + tostr(mom)) +
")";
else
results = results + "--built-in";
endif
endif
endif
endfor
if (results)
this:tell("The property .", name, " is on", results);
else
this:tell("The property .", name, " is nowhere to be found.");
endif
.
find_verbs_on:
"'find_verbs_on ()' -> list of objects - Return the objects that @find searches when
looking for a verb. The objects are searched (and the results printed) in the order
returned. Feature objects are included in the search. Duplicate entries are removed
by the caller.";
return {this, this.location, @valid(this.location) ? this.location:contents() | {},
@this:contents(), @this.features};
.
find_properties_on:
"'find_properties_on ()' -> list of objects - Return the objects that @find searches
when looking for a property. The objects are searched (and the results printed) in
the order returned. Feature objects are *not* included in the search. Duplicate entries
are removed by the caller.";
return {this, this.location, @valid(this.location) ? this.location:contents() | {},
@this:contents()};
.