View/Edit #12:@folder*2

Switch to edit mode.

Name(s): @folder*2
1:  "All commands have a folder name first, possibly in quotation marks, and then a command such as a +, -, ++, rename, or delete."
2:  if (player != this)
3:    return $msg:mtell("huh")
4:  endif
5:  m = match(argstr, "^%(\"[^\"]+\"%|[^ ]+%)")
6:  if (!m)
7:    return player:tell("I can't understand your folder name. Please read the help on the @folder command, or use it with no arguments for an interactive @folder usage.")
8:  endif
9:  fname = argstr[m[3][1][1]..m[3][1][2]]
10: argstr = `argstr[m[2] + 1..$] ! E_RANGE => ""'
11: if (match(fname, "^\".*\"$"))
12:   fname = `fname[2..$ - 1] ! E_RANGE => ""'
13: endif
14: if (!(idx = $list_utils:iassoc(fname, this.audit_folders)))
15:   return player:tell("You don't seem to have a folder named '", fname, "'.")
16: endif
17: m = match(argstr, " *%(%+%+%|%+%|-%|rename%|delete%)")
18: if (!m)
19:   return player:tell("I can't understand your command. Please read the help on the @folder command, or use it with no arguments for interactive help.")
20: endif
21: cmd = argstr[m[3][1][1]..m[3][1][2]]
22: if (cmd == "+" || cmd == "++" || cmd == "-")
23:   whatstr = `argstr[m[3][1][2] + 1..$] ! E_RANGE => ""'
24:   if ($command_utils:object_match_failed(what = player:my_match_object(whatstr), whatstr))
25:     return
26:   elseif (cmd == "+" || cmd == "-")
27:     if (what.owner != player)
28:       return player:tell("You don't own ", $su:nn(what), ".")
29:     endif
30:     for x in [1..length(this.audit_folders)]
31:       this.audit_folders[x][2] = setremove(this.audit_folders[x][2], what)
32:     endfor
33:     if (cmd == "+")
34:       this.audit_folders[idx][2] = setadd(this.audit_folders[idx][2], what)
35:     endif
36:     return player:tell(cmd == "+" ? "Addition" | "Removal", " completed.")
37:   else
38:     for y in (this.owned_objects)
39:       if (y:isa(what))
40:         for x in [1..length(this.audit_folders)]
41:           this.audit_folders[x][2] = setremove(this.audit_folders[x][2], y)
42:         endfor
43:         this.audit_folders[idx][2] = setadd(this.audit_folders[idx][2], y)
44:       endif
45:     endfor
46:     player:tell("Gathering completed.")
47:   endif
48: elseif (cmd == "rename")
49:   m = match(argstr, "%(\"[^\"]+\"%|[^ ]+%) *$")
50:   if (!m)
51:     return player:tell("I didn't understand what you wanted me to rename that to.")
52:   endif
53:   newname = argstr[m[3][1][1]..m[3][1][2]]
54:   if (match(newname, "^\".*\"$"))
55:     newname = `newname[2..$ - 1] ! E_RANGE => ""'
56:   endif
57:   this.audit_folders[idx][1] = newname
58:   player:tell("Rename completed.")
59: elseif (cmd == "delete")
60:   this.audit_folders = listdelete(this.audit_folders, idx)
61:   player:tell("Folder removed.")
62: else
63:   return player:tell("I didn't understand that.")
64: endif
65: "Last modified by Dax (#789) on Wed Jan 24 17:28:20 2007 EST."

Verb arguments: any any any
Verb perms: Readable NOT-Debug
Verb owned by: Lao-Tzu (#8084)

You are not logged in.

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