View/Edit #13:@create

Switch to edit mode.

Name(s): @create
1:  set_task_perms(player)
2:  nargs = length(args)
3:  pos = "named" in args
4:  if (pos <= 1 || pos == nargs)
5:    pos = "called" in args
6:  endif
7:  if (pos <= 1 || pos == nargs)
8:    player:tell("Usage: @create &lt;parent-class&gt; named name,alias,alias...")
9:    player:tell("where &lt;parent-class&gt; is one of the standard classes ($thing, $note...) or an object number (e.g. #123), or the name of an object in the current room.  You can use 'called' instead of 'named'.")
10:   return
11: endif
12: parentstr = $string_utils:from_list(args[1..pos - 1], " ")
13: namestr = $string_utils:from_list(args[pos + 1..nargs], " ")
14: parent = player:my_match_object(parentstr)
15: if ($command_utils:object_match_failed(parent, parentstr))
16:   return
17: endif
18: object = $recycler:create(parent)
19: if (typeof(object) == $ERR)
20:   return player:tell(object)
21: endif
22: x = 0
23: while (object.owner == $nothing)
24:   suspend(0)
25:   x = x + 1
26:   if (x == 5)
27:     return player:tell("Unable to @create object.  Try again.  If that fails, talk to a wizard.")
28:   endif
29: endwhile
30: $building_utils:set_names(object, namestr)
31: if (object:isa($player))
32:   move(object, player.location)
33: elseif (object:isa($room))
34:   move(object, $czone)
35: elseif (object:isa($physical))
36:   move(object, player)
37: endif
38: other_names = setremove(object.aliases, object.name)
39: if (!other_names)
40:   $msg:mtell("created", object, parent)
41: else
42:   $msg:mtell("created_aka", object, parent, other_names)
43: endif
44: "Last modified by Dax (#789) on Tue May  3 13:45:55 2005 MDT."

Verb arguments: any any any
Verb perms: Readable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

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