View/Edit #12:_pros

Switch to edit mode.

Name(s): _pros
1:  caller == this || raise(E_PERM)
2:  set_task_perms(this)
3:  lines = sizes = {}
4:  linelength = player:linelength() > 79 ? player:linelength() | 79
5:  for o in (args)
6:    if (!$recycler:valid(o))
7:      lines[1..0] = {tostr("              ", $string_utils:right(o, 6), " Invalid Object!")}
8:      sizes[1..0] = {0}
9:    else
10:     kids = 0
11:     for k in (children(o))
12:       $command_utils:suspend_if_needed()
13:       if (k.owner != o.owner)
14:         kids = 2
15:       elseif (kids == 0)
16:         kids = 1
17:       endif
18:     endfor
19:     "The verbs() call below might fail, but that's OK"
20:     v = `verbs(o) ! ANY'
21:     vstr = v ? tostr("[", $string_utils:right(length(v), 3), "] ") | "      "
22:     if (o.r && o.f)
23:       r = "f"
24:     elseif (o.r)
25:       r = "r"
26:     elseif (o.f)
27:       r = "F"
28:     else
29:       r = " "
30:     endif
31:     category = ""
32:     cl = {$player, $room, $exit, $note, $container, $thing, $newsgroup}
33:     cs = {"P", "R", "E", "N", "C", "T", "M"}
34:     if (is_player(cat_o = o))
35:       category = "P"
36:     endif
37:     while (valid(cat_o) && !category)
38:       if (i = cat_o in cl)
39:         category = cs[i]
40:       endif
41:       cat_o = parent(cat_o)
42:     endwhile
43:     vstr = tostr(" kK"[kids + 1], r, category ? category | " ", vstr)
44:     size = `o:object_bytes() ! ANY'
45:     if (!size)
46:       sizestr = " ???"
47:     elseif (size < $kb)
48:       sizestr = " &lt;1K"
49:     elseif (size < $kb * $kb)
50:       sizestr = tostr($string_utils:right(size / $kb, 3), "K")
51:     else
52:       sizestr = tostr($string_utils:right(size / ($kb * $kb), 3), "M")
53:     endif
54:     vstr = tostr(sizestr, " ", vstr)
55:     name_field_len = 26
56:     if (valid(o.location) && !$object_utils:isa(o, $exit))
57:       loc = (o.location.owner == o.owner ? " " | "*") + "[" + o.location:title() + "]"
58:     elseif ($object_utils:has_property(o, "dest"))
59:       if (typeof(o.location) != $OBJ)
60:         source = " &lt;non-object&gt; "
61:       elseif (!valid(o.location))
62:         source = "&lt;invalid&gt;"
63:       else
64:         source = o.location:title()
65:         if (o.location.owner != o.owner)
66:           source = "*" + source
67:         endif
68:       endif
69:       if (typeof(o.dest) != $OBJ)
70:         destin = " &lt;non-object&gt; "
71:       elseif (!valid(o.dest))
72:         destin = "&lt;invalid&gt;"
73:       else
74:         destin = o.dest:title()
75:         if (o.dest.owner != o.owner)
76:           destin = "*" + destin
77:         endif
78:       endif
79:       srclen = length(source) < 20 ? length(source) | 19
80:       destlen = length(destin) < 20 ? length(destin) | 19
81:       loc = " " + source[1..srclen] + "->" + destin[1..destlen]
82:     else
83:       loc = " [Nowhere]"
84:     endif
85:     if (length(loc) > 41)
86:       loc = loc[1..37] + "..]"
87:     endif
88:     otitle = o:title()
89:     namelen = length(otitle) < name_field_len ? length(otitle) | name_field_len - 1
90:     lines[1..0] = {tostr(vstr, $string_utils:right(o, 6), " ", $string_utils:left(otitle[1..namelen], name_field_len), loc)}
91:     length(lines[1]) > linelength && (lines[1] = lines[1][1..linelength])
92:     sizes[1..0] = {`o:object_bytes() ! ANY'}
93:   endif
94:   $command_utils:suspend_if_needed()
95: endfor
96: $tcm || (lines = $list_utils:sort(lines, sizes))
97: player:tell(lines)
98: "Last modified by Dax (#789) on Wed May  4 06:44:30 2005 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

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