View/Edit #12:@folder*1

Switch to edit mode.

Name(s): @folder*1
1:  if (player != this)
2:    return $msg:mtell("huh")
3:  endif
4:  if (this.audit_folders != {})
5:    for x in (this.audit_folders)
6:      player:tell("  [", x in this.audit_folders, "]: ", x[1], " (", length(x[2]), " objects in folders)")
7:    endfor
8:    player:tell("  [N]: Create a new folder")
9:    cmd = $cmd_utils:read("choose a folder to add or remove an object from")
10:   if ($su:is_numeric(cmd))
11:     try
12:       fname = this.audit_folders[idx = toint(cmd)][1]
13:     except (E_RANGE)
14:       return player:tell("You don't seem to have a folder numbered '", cmd, "'.")
15:     endtry
16:     player:tell({"  [A]: Add an object to folder", "  [D]: Remove an object from folder", "  [R]: Rename folder", "  [G]: Gather objects", "  [X]: Delete folder"})
17:     cmd = $cmd_utils:read("choose an action")
18:     force = tostr("@folder \"", fname, "\" ")
19:     if (cmd == "A" || cmd == "D")
20:       whatstr = $cmd_utils:read("object")
21:       if ($command_utils:object_match_failed(what = player:my_match_object(whatstr), whatstr))
22:         return
23:       endif
24:       force = tostr(force, cmd == "a" ? "+" | "-", what)
25:     elseif (cmd == "R")
26:       newname = $cmd_utils:read("new name")
27:       if (newname in $list_utils:slice(this.audit_folders, 1))
28:         return player:tell("You already have a folder named that.")
29:       endif
30:       force = tostr(force, "rename to \"", newname, "\"")
31:     elseif (cmd == "G")
32:       whatstr = $cmd_utils:read("the parent object to gather based upon")
33:       if ($command_utils:object_match_failed(what = player:my_match_object(whatstr), whatstr))
34:         return
35:       endif
36:       force = tostr(force, "++", tostr(what))
37:     elseif (cmd == "X")
38:       force = tostr(force, "delete")
39:     else
40:       return player:tell("I didn't understand that.")
41:     endif
42:     player:tell("Command: ", force)
43:     force_input(player, force)
44:     return
45:   elseif (cmd != "N")
46:     return player:tell("I don't understand that.")
47:   endif
48: endif
49: name = $cmd_utils:read("new folder name")
50: if (name in $list_utils:slice(this.audit_folders, 1))
51:   return player:tell("You already have a folder named that.")
52: endif
53: this.audit_folders = {@this.audit_folders, {name, {}}}
54: player:tell("Folder created.")
55: "Last modified by Dax (#789) on Tue May  3 14:09:29 2005 MDT."

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

You are not logged in.

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