# Portable source form of MOO database

Larry Mulcahy (larry@ambient.uucp)
Sun, 3 Dec 1995 15:41:00 PST

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    Shouting to be heard above the roaring chainsaw of dismemberment on Thu,
    30 Nov 1995 07:14:20 -0500 (EST), Kipp the Kidd bellowed:

      Kipp> There is, though, a verb that is called every time the server
      Kipp> wants to match an object; <player>:my_match_object(<objname>);
      Kipp> The verb normally calls :match and then
      Kipp> $string_utils:match_object.

    I managed to get the job done with match.  Still not sure where
    my_match_object fits in.

    In the example that follows, sdig works like the case in @dig that digs
    to an existing room, except it uses the room's Name string rather than
    it's object number.  Experienced MOOers will notice that I have only cut
    and pasted most of this out of the source of the regular @dig.

    The line

        to_o=$string_utils:match(to_str,player.owned_objects,"Name");

    is where the place name string gets converted into an object.

    ----------------------------------------------------------------------

    @create $feature named building
    @verb building:sdig
    @args building:sdig any any any
    @chmod building:sdig rxd
    @program building:sdig
    nargs = length(args);
    if (( nargs != 3 )||( args[2] != "to" ))
      player:notify(tostr("Usage: ", verb, " <exit-description> to <old-room-name>"));
      return;
    endif
    exit_spec = args[1];
    to_str = args[3];
    to_o=$string_utils:match(to_str,player.owned_objects,"Name");
    if (!valid(to_o) || !($room in $object_utils:ancestors(to_o)))
      player:notify(tostr(to_o, " doesn't look like a room to me..."));
      return;
    endif
    exit_kind = player:build_option("dig_exit");
    if (exit_kind == 0)
      exit_kind = $exit;
    endif
    exits = $string_utils:explode(exit_spec, "|");
    if (length(exits) < 1 || length(exits) > 2)
      player:notify("The exit-description must have the form");
      player:notify("     [name:]alias,...,alias");
      player:notify("or   [name:]alias,...,alias|[name:]alias,...,alias");
      return;
    endif
    do_recreate = !player:build_option("bi_create");
    to_ok = $building_utils:make_exit(exits[1], player.location, to_o, exit_kind);
    if (to_ok && length(exits) == 2)
      $building_utils:make_exit(exits[2], to_o, player.location, exit_kind);
    endif