Switch to edit mode.
Name(s): @dig1: set_task_perms(player)
2: if (!prepstr)
3: room = argstr
4: exit_spec = ""
5: elseif (length(args) >= 3 && args[2] in {"to", "a"})
6: exit_spec = args[1]
7: room = $su:from_list(args[3..$], " ")
8: else
9: player:tell({"Usage: @dig <new-room-name>", " or @dig <exit-description> to <new-room-name-or-old-room-object-number>"})
10: return
11: endif
12: other_room = tostr(toobj(room)) == $su:trim(room) ? toobj(room) | $room_db:find(room)
13: if (!valid(other_room))
14: try
15: other_room = $recycler:create(this.digwith[1])
16: except e (ANY)
17: return player:tell(e[1])
18: endtry
19: try
20: "In case the set_name does not terminate..."
21: stat = 0
22: stat = other_room:set_name(room) && other_room:set_aliases({room})
23: except (E_INVARG)
24: for name in ({room})
25: if (m = $room_db:why_not_available(name))
26: return player:tell("You cannot use the name ", name, " because ", m)
27: endif
28: endfor
29: $msg:mtell("rename_bad")
30: except (E_NACC)
31: $msg:mtell("db_frozen")
32: except e (ANY)
33: player:tell(e[1])
34: endtry
35: if (stat)
36: other_room:moveto($czone)
37: $msg:mtell("dug_simple", other_room)
38: else
39: $recycler:recycle(other_room)
40: return
41: endif
42: elseif (length(args) == 1)
43: return $msg:mtell("dig_exists")
44: elseif (!valid(player.location) || !($room in $object_utils:ancestors(player.location)))
45: return $msg:mtell("not_room", player.location)
46: elseif (!valid(other_room) || !($room in $object_utils:ancestors(other_room)))
47: return $msg:mtell("not_room", other_room)
48: endif
49: if (exit_spec)
50: exits = $string_utils:explode(exit_spec, "|")
51: if (length(exits) < 1 || length(exits) > 2)
52: $msg:mtell("dig_exitspec_usage")
53: endif
54: to_ok = $building_utils:make_exit($su:is_numeric(exits[1]) ? toint(exits[1]) | exits[1], player.location, other_room)
55: if (to_ok && length(exits) == 2)
56: $building_utils:make_exit($su:is_numeric(exits[2]) ? toint(exits[2]) | exits[2], other_room, player.location)
57: endif
58: endif
59: "Last modified by Dax (#789) on Tue May 3 14:09:29 2005 MDT."