parent $libraries
object $command
var $root dbref 'command
var $root child_index 0
var $root fertile 0
var $root manager $command
var $root owned [$command]
var $root owners [$]
var $root writable []
var $root readable ['parameters, 'methods, 'code]
var $root inited 1
var $command argument_types [["any", "any"], ["text", "any"], ["string", "any"], ["object", "object"], ["thing", "thing"], ["user", "user"], ["descendant of *", "descendant"], ["this", "this"], ["number", "number"]]
method convert_arg_any
arg str, [args];
return str;
.
method convert_arg_object
arg str, [args];
return (> $object.to_dbref(str) <);
.
method convert_arg_user
arg str, [args];
return (> $user_db.find(str) <);
.
method convert_arg_number
arg str, [args];
return (> str.to_number() <);
.
method convert_arg_thing
arg str, me, [args];
var obj;
obj = (> me.match_environment(str) <);
if (!(obj.has_ancestor($thing)))
throw(~parse, (obj.name()) + " is not descended from $thing!");
return obj;
.
method convert_arg_descendant
arg str, me, target, ancestor, [args];
var obj;
obj = (> me.match_environment(str) <);
if (!(obj.has_ancestor(ancestor)))
throw(~parse, (((obj.name()) + " is not descended from ") + (ancestor.name())) + "!");
return obj;
.
method convert_arg_this
arg str, me, target, [args];
var obj;
obj = (> me.match_environment(str) <);
if (obj != target)
throw(~parse, (obj.name()) + " is not this!");
return obj;
.
method get_argument_type
arg type;
var x, m;
for x in [1 .. listlen(argument_types)] {
m = match_pattern((argument_types[x])[1], type);
if (type(m) == 'list) {
switch ((argument_types[x])[2]) {
case "descendant":
if (!m)
throw(~type, "Argument type \"descendant of\" must have an object.");
return [(argument_types[x])[2], [(> $object.to_dbref(m[1]) <)]];
default:
return [(argument_types[x])[2], []];
}
}
}
throw(~command, ("Invalid command argument type \"" + type) + "\"");
.