View/Edit #8045:@alias

Switch to edit mode.

Name(s): @alias
1:  "Copied from Lao-Tzu (#8084):@alias Mar 10 17:55:15 1998"
2:  "Verb syntax:"
3:  "  @alias <command>=<alias>      Creates an alias."
4:  "  @alias -<command>             Deletes an alias."
5:  "  @alias                        Lists all aliases."
6:  player != this && raise(E_PERM, "Interesting.")
7:  if (!argstr)
8:    if (!this.cmd_aliases)
9:      player:sub_tell("You have no command aliases.")
10:     player:tell($help_utils:verb_documentation(this, verb))
11:   else
12:     player:tellColumns({20, 50}, {"Command", "Alias"}, @this.cmd_aliases)
13:   endif
14:   return
15: endif
16: if (!index(argstr, "=") && argstr[1] == "-")
17:   command = argstr[2..$]
18:   if (!$list_utils:iassoc(command, this.cmd_aliases))
19:     return player:sub_tell("You can't remove the alias \"%1\", because it doesn't exist. Type '@alias' for a list of all your current aliases.", command)
20:   endif
21:   player:sub_tell("Are you sure you want to remove the alias \"%1\"?", command)
22:   !$cmd_utils:yes_or_no() && {player:tell("Not removing it."), kill_task(task_id())}
23:   this.cmd_aliases = listdelete(this.cmd_aliases, $list_utils:iassoc(command, this.cmd_aliases))
24:   return player:sub_tell("Alias deleted.")
25: endif
26: try
27:   {command, alias} = $su:explode(argstr, "=")
28: except (E_ARGS)
29:   return player:tell("Proper format: @alias <command>=<alias>, where 'command' is what you type, and 'alias' is what the MOO will replace it with.")
30: endtry
31: if (q = $list_utils:iassoc(command, this.cmd_aliases))
32:   player:sub_tell("\"%1\", which was previously aliased to \"%2\", now changed to \"%3\".", command, this.cmd_aliases[q][2], alias)
33:   this.cmd_aliases[q][2] = alias
34: else
35:   player:sub_tell("\"%1\" will now be replaced with \"%2\" when \"%1\" is the first section of a command.", command, alias)
36:   this.cmd_aliases = {@this.cmd_aliases, {command, alias}}
37: endif
38: "Last modified by Dax (#789) on Wed Jan 24 17:28:25 2007 EST."

Verb arguments: any any any
Verb perms: Readable NOT-Debug
Verb owned by: Myra (#8045)

You are not logged in.

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