Method code for $builder._build__get_location()

[Turn on line numbering]
arg name;
var dest, m, realm, parent, str;

(> .perms(sender()) <);
._build__hint(1);
if (name) {
    if ((m = match_template(name, "to *")))
        name = m[2];
    name = (| $code_lib.parse_name(name) |);
}
while (!name) {
    catch any {
        name = (> ._build__get_name("Destination: ") <);
        str = name[1][1];
        if ((m = regexp(str, "^ *\$([a-z0-9_]+) *(.*)$"))) {
            name = replace(name, 1, replace(name[1], 1, m[2]));
            catch ~namenf, ~symbol {
                parent = (> lookup(tosym(m[1])) <);
            } with {
                .tell(traceback()[1][1]);
                continue;
            }
            if (!parent.is($place)) {
                .tell("Parent object " + parent.namef('ref) + " is not a place!");
                continue;
            } else if (!parent.has_flag('fertile) && !parent.is_writable_by(this())) {
                .tell("Parent object " + parent.namef('ref) + " is not fertile!");
                continue;
            }
        }
    } with {
        if (error() == ~skip) {
            .tell("You cannot skip this step!");
            continue;
        }
        rethrow(error());
    }
}

// first try to see if it already exists--only do this if they used
// the direct $dbref too many conflicts otherwise.
catch any {
    dest = (> $object_lib.to_dbref(name[1][1]) <);
    dest.is($place) || throw(~place, dest.namef('ref) + " is not a place.");
    return [dest, 0];
}

// create it
._build__hint(2);
if (!parent)
    dest = (> $place_lib.get_default('place).spawn() <);
else
    dest = (> parent.spawn() <);
._build__set_name(dest, @name);
._build__hint(4);
catch any {
    realm = (> ._build__query_realm(dest) <);
} with {
    if (error() == ~skip)
        return dest;
    ._build__cleanup([dest, 1]);
    rethrow(error());
}

// set the realm
dest.set_setting_realm($place, "realm", realm);

// add this room to realm's 'local' variable
realm.add_local(dest);

// okee, done
return [dest, 1];

// $#Created: 13 Sep 97 15:11 $brandon
// $#Edited: 29 Oct 97 00:07 $vampire
// $#Edited: 20 Apr 04 22:15 $brandon
// $#Edited: 20 Apr 04 22:23 $brandon

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark