Switch to edit mode.
Name(s): @disown @disinherit1: "Copied from Generic Programming student&&Etudiant d'informatique generique (#3924):@disown by Sleeping_Beauty (#2) Sat Jul 1 04:24:36 1995 EDT"
2: "Syntax: @disown <object> [from <object>]"
3: "This command is used to remove unwanted children of objects you control. If you control an object, and there is a child of that object you do not want, this command will chparent() the object to its grandparent."
4: if (prepstr)
5: if (prepstr != "from")
6: player:notify("Usage: ", verb, " <object> [from <object>]")
7: return
8: elseif ($command_utils:object_match_failed(iobj = player:my_match_object(iobjstr), iobjstr))
9: "... from WHAT?.."
10: return
11: elseif (valid(dobj = $string_utils:literal_object(dobjstr)))
12: "... literal object number..."
13: if (parent(dobj) != iobj)
14: player:notify(tostr(dobj, " is not a child of ", iobj.name, " (", iobj, ")"))
15: return
16: endif
17: elseif ($command_utils:object_match_failed(dobj = $string_utils:match(dobjstr, children(iobj), "name", children(iobj), "aliases"), dobjstr))
18: "... can't match dobjstr against any children of iobj"
19: return
20: endif
21: elseif ($command_utils:object_match_failed(dobj = player:my_match_object(dobjstr), dobjstr))
22: "... can't match dobjstr..."
23: return
24: endif
25: victim = dobj
26: parent = parent(victim)
27: if ($perm_utils:controls(player, victim))
28: "... why is he using @disown?... probably by mistake..."
29: player:notify(tostr(victim.name, " (", victim, ") is yours. Use @chparent."))
30: elseif (!valid(parent))
31: player:notify(tostr(victim.name, " (", victim, ") is already an orphan."))
32: elseif (!$perm_utils:controls(player, parent))
33: player:notify(tostr(parent.name, " (", parent, "), the parent of ", victim.name, " (", victim, "), is not yours."))
34: else
35: set_task_perms(victim.owner)
36: grandparent = parent
37: while (1)
38: if (!valid(grandparent = parent(grandparent)))
39: "I dunno... should we do the chparent anyway? Shouldn't matter for anything that's descended from $root."
40: player:tell("Odd... there is no valid grandparent to chparent the object too!")
41: return
42: endif
43: if ($perm_utils:perm_f(victim.owner, grandparent))
44: $building_utils:chparent(victim, grandparent)
45: player:tell(victim.name, " (", victim, ") chparented to ", grandparent.name, " (", grandparent, ").")
46: return
47: endif
48: endwhile
49: endif
50: "Last modified by Dax (#789) on Thu Nov 8 11:38:30 2001 MST."