View/Edit #85:add_ref

Switch to edit mode.

Name(s): add_ref
1:  "Adds a $reference."
2:  caller == this || raise(E_PERM)
3:  player:isa($webber) || raise(E_PERM)
4:  if (player.referer && $www:previous_object() != this)
5:    "We have an unknown form refering an reference add to us..."
6:    $msg:mtell("www_error", "Warning!  Previous page doesn't appear to be this one!")
7:    player:tell("For security reasons the reference addition will not be executed.  Refering page: [", player.referer, "]")
8:    return
9:  endif
10: {add, base, object} = args
11: if (!$su:is_numeric(base))
12:   raise(E_INVARG)
13: elseif (!$su:is_numeric(object))
14:   return $msg:mtell("www_error", "'" + object + "' isn't a number!")
15: endif
16: base = toobj(base)
17: object = toobj(object)
18: if (!valid(base) || !base:isa($base_0) || !$isa(base))
19:   raise(E_INVARG)
20: elseif (!player.user.wizard && base != $ref_db)
21:   raise(E_PERM)
22: elseif (!$recycler:valid(object))
23:   $msg:mtell("www_error", tostr(object, " isn't a valid object!"))
24: elseif (!player.user:controls(object))
25:   $msg:mtell("www_error", "Permission denied!")
26:   player:tell("<B>You don't control ", object, ".</B><BR>")
27: elseif (!$ref_name_ok(add))
28:   $msg:mtell("www_error", "The Moo won't understand your reference, as it contains illegal characters.")
29:   player:tell("<B>The name of a variable is made up entirely of letters, digits and the underscore character ('_') and does not begin with a digit.</B><BR>")
30: elseif ($has_property(add))
31:   $msg:mtell("www_error", "$" + add + " already exists!")
32:   player:tell("<B>Delete the existing one and recreate.</B><BR>")
33: elseif (!player.user.wizard && (x = $ref_db:has_property_with_value(add)))
34:   $msg:mtell("www_error", "That object already has a reference!")
35:   player:tell("<B>Delete the $", x, " reference one first.</B><BR>")
36: else
37:   add_property(base, add, object, {$slacker, "r"})
38:   player:tell("<B>$", add, " now refers to ", object:nn(), ".</B><BR>")
39: endif
40: "Last modified by Dax (#789) on Sun Jul 28 06:24:51 2002 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]