@verb #13:"@dump 2dump" any any any ro #55 @program #13:"@dump 2dump" any any any "@dump something [with [id=...] [noprops] [noverbs] [create]]" "This spills out all properties and verbs on an object, calling suspend at appropriate intervals." " id=#nnn -- specifies an idnumber to use in place of the object's actual id (for porting to another MOO)" " noprops -- don't show properties." " noverbs -- don't show verbs." " create -- indicates that a @create command should be generated and all of the verbs be introduced with @verb rather than @args; the default assumption is that the object already exists and you're just doing this to have a look at it." " owner=#n - Uses #n in place of the actual owner (in case you're not actually going to be creating the object for yourself)." " wiz=#nn -- Uses #nn in place of the actual owner of any wiz-permed verbs on the object, that are not owned by the object's owner." "nonwiz=#n - Uses #n in place of the actual owner of any non-wiz-permed verbs on the object, that are not owned by the object's owner." "no_oflags - ignore any 'o' permissions that may appear on any of the verbs." " nohold -- Do not enable output stream locking while the dump is in progress (?)" if (player != this) return $msg:mtell("huh") endif set_task_perms(this) "dobj = player:my_match_object(dobjstr);" "lazy object matching ($match_object)" if ($command_utils:object_match_failed(dobj, dobjstr)) return elseif (prepstr && prepstr != "with") return player:tell("Usage: ", verb, " something [with [id=...] [noprops] [noverbs] [create]]") endif player:tell("Compiling @dump...") text = {} targname = tostr(dobj) options = {"props", "verbs"} create = 0 o_flags = 1 owner = tostr(dobj.owner) nogag = 0 explicit = 0 if (iobjstr) for o in ($string_utils:explode(iobjstr)) if (index(o, "id=") == 1) targname = o[4..$] elseif (index(o, "owner=") == 1) owner = o[7..$] elseif (o in {"noprops", "noverbs"}) options = setremove(options, o[3..$]) elseif (o in {"create"}) create = 1 elseif (o in {"nogag"}) nogag = 1 elseif (o in {"explicit"}) explicit = 1 elseif (o in {"no_oflag"}) o_flags = 0 elseif (index(o, "wiz=") == 1) wiztargname = o[5..$] elseif (index(o, "nonwiz=") == 1) nonwiztargname = o[8..$] endif endfor endif if (create) parent = parent(dobj) pstring = tostr(parent) for p in ($all_properties()) if (#0.(p) == parent) pstring = "$" + p endif endfor text = {@text, tostr("@create ", pstring, " named ", dobj.name, ":", $string_utils:from_list(dobj.aliases, ","))} endif if (filelist = `dobj:filelist() ! E_PERM => {"E_PERM (Permission denied)"}') text = {@text, tostr(";\"Files in off-line dir: ", $string_utils:english_list(filelist), "\"")} endif for p in ("props" in options ? properties(dobj) | {}) pquoted = toliteral(p) info = property_info(dobj, p) value = dobj.(p) if (create) uvalue = typeof(value) == $LIST ? "{}" | 0 text = {@text, tostr("@prop ", targname, ".", pquoted, " ", uvalue || toliteral(value), " ", info[2] || "\"\"", info[1] == dobj.owner && !explicit ? "" | (info[1] == dobj.owner ? tostr(" ", owner) | `info[1].wizard ? tostr(" ", wiztargname || owner) | tostr(" ", nonwiztargname || owner) ! E_VARNF => tostr(" ", owner)'))} if (uvalue && value) text = {@text, tostr(";;", targname, ".(", pquoted, ") = ", toliteral(value))} endif else if (info[2] != "rc") text = {@text, tostr("@chmod ", targname, ".", pquoted, " ", info[2])} endif if (info[1] != dobj.owner) text = {@text, tostr("@chown ", targname, ".", pquoted, " to ", info[1])} endif text = {@text, tostr(";;", targname, ".(", pquoted, ") = ", toliteral(value))} endif $command_utils:suspend_if_needed() endfor for a in ("props" in options ? $object_utils:ancestors(dobj) | {}) for p in (properties(a)) $command_utils:suspend_if_needed() pquoted = toliteral(p) value = dobj.(p) avalue = a.(p) if (typeof(value) == $ERR) text = {@text, tostr("\"", targname, ".(", pquoted, ") => ", $code_utils:error_name(value), " (", value, ")")} elseif (typeof(avalue) == $ERR || !is_clear_property(dobj, p)) text = {@text, tostr(";;", targname, ".(", pquoted, ") = ", toliteral(value))} endif endfor $command_utils:suspend_if_needed() endfor if ("verbs" in options) text = {@text, ""} v = 1 while ((info = `verb_info(dobj, v) ! ANY') || info == E_PERM) suspend(0) if (typeof(info) == $ERR) text = {@text, tostr("\"", dobj, ":", v, " --- ", info, "\";")} else if (i = index(vname = info[3], " ")) vname = vname[1..i - 1] endif if (vname[1] != "*") vname = strsub(vname, "*", "") endif args = verb_args(dobj, v) prep = args[2] in {"any", "none"} ? args[2] | $code_utils:short_prep(args[2]) perms = info[2] != (args == {"this", "none", "this"} ? "rxdo" | "rdo") ? info[2] || "\"\"" | (explicit ? info[2] | "") " perms = o_verbs ? perms | (y = index(perms, \"o\") ? perms[1..y - 1] | perms);" vown = info[1] == dobj.owner ? owner | (info[1].wizard ? wiztargname | nonwiztargname) vown = vown == E_VARNF ? info[1] | vown if (create) if (info[1] == dobj.owner && !explicit) tail = perms ? tostr(" ", perms) | "" else tail = tostr(" ", perms || info[2], " ", vown) endif text = {@text, tostr("@verb ", targname, ":\"", info[3], "\" ", args[1], " ", prep, " ", args[3], tail)} else text = {@text, tostr("@args ", targname, ":\"", info[3], "\" ", args[1], " ", prep, " ", args[3])} if (info[1] != dobj.owner) text = {@text, tostr("@chown ", targname, ":", vname, " to ", info[1])} endif if (perms) text = {@text, tostr("@chmod ", targname, ":", vname, " ", perms)} endif endif if (code = verb_code(dobj, v, 1, 1)) text = {@text, tostr("@program ", targname, ":", vname), @code, ".", ""} endif endif v = v + 1 $command_utils:suspend_if_needed() endwhile endif text = {@text, "\"***finished***"} player:notify_direct_suspended(text) "Last modified by Dax (#789) on Tue May 3 13:57:40 2005 MDT." .