View/Edit #12:_rename_obj

Switch to edit mode.

Name(s): _rename_obj
1:  "Rename an object.  Called by @rename."
2:  set_task_perms(caller_perms())
3:  {object, iobjstr} = args
4:  iobjstr = player:input_get_raw(iobjstr)
5:  old_name = object.name
6:  old_aliases = object.aliases
7:  new_names = $building_utils:parse_names(iobjstr)
8:  new_name = new_names[1] || object.name
9:  if (object:isa($player))
10:   name_database = $player_db
11: elseif (object:isa($room))
12:   name_database = $room_db
13: else
14:   name_database = $nothing
15: endif
16: try
17:   r = object:_set_aliases(new_names[2]) && object:_set_name(new_name)
18:   if (!r)
19:     return player:tell(r)
20:   endif
21:   new_aliases = setremove(object.aliases, object.name)
22:   $msg:mtell(new_aliases ? "renamed_aka" | "renamed", object, new_aliases)
23: except (E_INVARG)
24:   for name in (new_names)
25:     if (m = name_database:why_not_available(name))
26:       return player:tell("You cannot use the name ", name, " because ", m)
27:     endif
28:   endfor
29:   return $msg:mtell("rename_bad")
30: except (E_NACC)
31:   return $msg:mtell("db_frozen")
32: except (E_ARGS)
33:   return $msg:mtell("rename2long")
34: except e (ANY)
35:   return player:tell(e)
36: endtry
37: "Last modified by Cecil (#7407) on Fri Aug 23 12:35:11 2002 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

[home | help | who | search | setup | code]