View/Edit #12:@rmalias

Switch to edit mode.

Name(s): @rmalias
1:  "Syntax: @rmalias <alias>[,...,<alias>] from <object>"
2:  "        @rmalias <alias>[,...,<alias>] from <object>:<verb>"
3:  ""
4:  "The first form is used to remove aliases from an object.  If the object is a valid player, space and commas will be assumed to be separations between unwanted aliases.  Otherwise, only commas will be assumed to be separations."
5:  "[5/10/93 Nosredna: flushed above is_player feature"
6:  "Note that @rmalias will not affect the object's name, only its aliases."
7:  ""
8:  "The second form is for use by programmers, to remove aliases from a verb they own.  All spaces and commas are assumed to be separations between unwanted aliases."
9:  if (player != this)
10:   return
11: endif
12: set_task_perms(player)
13: spec = $code_utils:parse_verbref(iobjstr)
14: if (spec)
15:   object = player:my_match_object(spec[1])
16:   if (!$command_utils:object_match_failed(object, spec[1]))
17:     vname = spec[2]
18:     try
19:       info = verb_info(object, vname)
20:     except (E_VERBNF)
21:       return player:notify("That object does not define that verb.")
22:     except e (ANY)
23:       return player:tell(e)
24:     endtry
25:     old_aliases = $string_utils:explode(info[3])
26:     not_used = {}
27:     for alias in (bad_aliases = $list_utils:remove_duplicates($string_utils:explode(strsub(dobjstr, ",", " "))))
28:       if (!(alias in old_aliases))
29:         not_used = {@not_used, alias}
30:         bad_aliases = setremove(bad_aliases, alias)
31:       else
32:         old_aliases = setremove(old_aliases, alias)
33:       endif
34:     endfor
35:     if (not_used)
36:       player:notify(tostr(object.name, "(", object, "):", vname, " does not have the alias", length(not_used) > 1 ? "es" | "", " ", $string_utils:english_list(not_used), "."))
37:     endif
38:     if (bad_aliases && old_aliases)
39:       aliases = $string_utils:from_list(old_aliases, " ")
40:       info[3] = aliases
41:       result = set_verb_info(object, vname, info)
42:       if (typeof(result) == $ERR)
43:         player:notify(tostr(result))
44:       else
45:         player:notify(tostr("Alias", length(bad_aliases) > 1 ? "es" | "", " ", $string_utils:english_list(bad_aliases), " removed from verb ", $string_utils:nn(object), ":", vname))
46:         player:notify(tostr("Verbname is now ", $string_utils:nn(object), ":\"", aliases, "\""))
47:       endif
48:     elseif (!old_aliases)
49:       player:notify("You have to leave a verb with at least one alias.")
50:     endif
51:   endif
52: else
53:   object = player:my_match_object(iobjstr)
54:   if (!$command_utils:object_match_failed(object, iobjstr))
55:     old_aliases = object.aliases
56:     not_used = {}
57:     for alias in (bad_aliases = $list_utils:remove_duplicates($list_utils:map_arg($string_utils, "trim", $string_utils:explode(dobjstr, ","))))
58:       "removed is_player(object) ? strsub(dobjstr, \" \", \",\") | --Nosredna"
59:       if (!(alias in old_aliases))
60:         not_used = {@not_used, alias}
61:         bad_aliases = setremove(bad_aliases, alias)
62:       else
63:         old_aliases = setremove(old_aliases, alias)
64:       endif
65:     endfor
66:     if (not_used)
67:       player:notify(tostr(object.name, "(", object, ") does not have the alias", length(not_used) > 1 ? "es" | "", " ", $string_utils:english_list(not_used), "."))
68:     endif
69:     if (bad_aliases)
70:       try
71:         r = object:set_aliases(old_aliases)
72:         player:notify(tostr("Alias", length(bad_aliases) > 1 ? "es" | "", " ", $string_utils:english_list(bad_aliases), " removed from ", object.name, "(", object, ")."))
73:         player:notify(tostr("Aliases for ", object.name, "(", object, ") are now ", $string_utils:from_value(old_aliases, 1)))
74:       except (E_INVARG)
75:         player:notify("That particular name change not allowed (see help @rename or help @rmalias).")
76:       except (E_NACC)
77:         player:notify("Oops.  You can't update that object's aliases right now; try again in a few minutes.")
78:       except e (ANY)
79:         player:notify(tostr(e))
80:       endtry
81:     endif
82:   endif
83: endif
84: "Last modified by Dax (#789) on Thu May  5 17:15:48 2005 MDT."

Verb arguments: any out of/from inside/from any
Verb perms: Readable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

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