@verb #12:"@addalias @add-alias 2addalias" any at/to any rdo #55 @program #12:"@addalias @add-alias 2addalias" any at/to any "Syntax: @addalias [,...,] to " " @addalias [,...,] to :" "" "The first form is used to add aliases to an object's list of aliases. You can separate multiple aliases with commas. The aliases will be checked against the object's current aliases and all aliases not already in the object's list of aliases will be added." "" "Example:" "Muchkin wants to add new aliases to Rover the Wonder Dog:" " @addalias Dog,Wonder Dog to Rover" "Since Rover the Wonder Dog already has the alias \"Dog\" but does not have the alias \"Wonder Dog\", Munchkin sees:" " Rover the Wonder Dog(#4237) already has the alias Dog." " Alias Wonder Dog added to Rover the Wonder Dog(#4237)." "" "If the object is a player, spaces will also be assumed to be separations between aliases and each alias will be checked against the Player Name Database to make sure no one else is using it. Any already used aliases will be identified." "" "Example:" "Munchkin wants to add his nicknames to his own list of aliases:" " @addalias Foobar Davey to me" "@Addalias recognizes that Munchkin is trying to add an alias to a valid player and checks the aliases against the Player Name Database. Unfortunately, DaveTheMan is already using the alias \"Davey\" so Munchkin sees:" " DaveTheMan(#5432) is already using the alias Davey" " Alias Foobar added to Munchkin(#1523)." "" "The second form of the @addalias command is for use by programmers, to add aliases to a verb they own. All commas and spaces are assumed to be separations between aliases." if (player != this) return $msg:mtell("huh") endif set_task_perms(player) spec = $code_utils:parse_verbref(iobjstr) if (spec) object = player:my_match_object(spec[1]) if (!$command_utils:object_match_failed(object, spec[1])) vname = spec[2] info = verb_info(object, vname) if (info == E_VERBNF) player:tell("That object does not define that verb.") elseif (typeof(info) == $ERR) player:tell(tostr(info)) else old_aliases = $string_utils:explode(info[3]) used = {} for alias in (new_aliases = $list_utils:remove_duplicates($string_utils:explode(strsub(dobjstr, ",", " ")))) if (alias in old_aliases) used = {@used, alias} new_aliases = setremove(new_aliases, alias) endif endfor if (used) player:tell(object.name, "(", object, "):", vname, " already has the alias", length(used) > 1 ? "es" | "", " ", $string_utils:english_list(used), ".") endif if (new_aliases) aliases = $string_utils:from_list({@old_aliases, @new_aliases}, " ") info[3] = aliases result = set_verb_info(object, vname, info) if (typeof(result) == $ERR) player:tell(result) else player:tell("Alias", length(new_aliases) > 1 ? "es" | "", " ", $string_utils:english_list(new_aliases), " added to verb ", $string_utils:nn(object), ":", vname) player:tell("Verbname is now ", $string_utils:nn(object), ":\"", aliases, "\"") endif endif endif endif else object = player:my_match_object(iobjstr) if (!$command_utils:object_match_failed(object, iobjstr)) old_aliases = object.aliases used = {} for alias in (new_aliases = $list_utils:remove_duplicates($list_utils:map_arg($string_utils, "trim", $string_utils:explode(is_player(object) ? strsub(dobjstr, " ", ",") | dobjstr, ",")))) if (alias in old_aliases) used = {@used, alias} new_aliases = setremove(new_aliases, alias) elseif (is_player(object) && valid(someone = $player_db:find_exact(alias))) player:tell(tostr(someone.name, "(", someone, ") is already using the alias ", alias, ".")) new_aliases = setremove(new_aliases, alias) endif endfor if (used) player:tell(object.name, "(", object, ") already has the alias", length(used) > 1 ? "es" | "", " ", $string_utils:english_list(used), ".") endif if (new_aliases) try player:tell("Attempting to add alias", length(new_aliases) > 1 ? "es" | "", " ", $string_utils:english_list(new_aliases), " to ", object.name, "(", object, ")...") r = object:set_aliases({@old_aliases, @new_aliases}) if (r != 1) " player:tell(r);" "Something more intelligent should be done here." endif player:tell("Aliases for ", $su:nn(object), " are now ", toliteral(object.aliases)) except (E_INVARG) player:tell("That particular name change not allowed (see help @rename or help @addalias).") except (E_NACC) player:tell("Oops. You can't update that object's aliases right now; try again in a few minutes.") except (E_QUOTA) player:tell("The maximum number of aliases you can have is ", $max_num_aliases, "!") except (E_PERM) player:tell(E_PERM) endtry endif endif endif "Last modified by Dax (#789) on Thu May 5 17:13:35 2005 MDT." .