Switch to edit mode.
Name(s): @ref*erence1: if (player != this)
2: return $msg:mtell("huh")
3: elseif (prepstr in {"is", "as"} && !player:isa($prog))
4: return $msg:mtell("huh")
5: elseif (prepstr in {"is", "as"})
6: if ($command_utils:object_match_failed(dobj, dobjstr))
7: return
8: elseif (!player:controls(dobj))
9: return player:tell("You cannot create a reference for an object you do not control.")
10: endif
11: if (!iobjstr)
12: force_input(player, "help @ref")
13: return
14: elseif (iobjstr[1] != "$")
15: return player:tell("All references must begin with '$', like '$", iobjstr, "'.")
16: elseif (`#0.(iobjstr[2..$]) ! E_PROPNF' != E_PROPNF)
17: return player:tell("That reference is already in use.")
18: elseif (!$ref_name_ok(iobjstr[2..$]))
19: player:tell("The Moo won't understand your reference, as it contains illegal characters.")
20: player:tell("The name of a variable is made up entirely of letters, digits and the underscore character ('_') and does not begin with a digit.")
21: return
22: endif
23: x = $ref_db:add_reference(dobj, iobjstr[2..$])
24: if (x == E_QUOTA)
25: if (!$cmd_utils:yes_or_no("That object already has a reference. Rename it to " + iobjstr + "?"))
26: return player:Tell("Not renamed.")
27: else
28: old = $find_ref(dobj)
29: $ref_db:rename_reference(dobj, iobjstr)
30: player:tell("Renamed.")
31: cmd = tostr("@grep! ", old, " on #0..", max_object(), ":")
32: player:tell("You may wish to ' <a xch_cmd='", cmd, "'>", cmd, "</a> ' to ensure that no verbs were using this reference.")
33: endif
34: else
35: return player:tell("Reference added, ", iobjstr, " == ", toliteral(dobj), ".")
36: endif
37: elseif (iobjstr == "" && prepstr == "")
38: if ($command_utils:object_match_failed(dobj, dobjstr))
39: return
40: elseif (x = $ref_db:has_property_with_value(dobj))
41: return player:tell($su:nn(dobj), " has the reference '$", x, "'.")
42: else
43: if (dobj:ref())
44: return player:tell($su:nn(dobj), " is corified as ", dobj:ref())
45: else
46: return player:tell($su:nn(dobj), " has no reference.")
47: endif
48: endif
49: elseif (iobjstr == "" && dobjstr && prepstr == "off")
50: old = $find_ref(dobj)
51: if ($command_utils:object_match_failed(dobj, dobjstr))
52: return
53: elseif (!player:controls(dobj))
54: return player:tell("That's not yours.")
55: elseif (`$ref_db:remove_reference(dobj) ! E_PROPNF' == E_PROPNF)
56: return player:tell("That object has no reference.")
57: else
58: cmd = tostr("@grep! ", old, " on #0..", max_object(), ":")
59: player:Tell($su:nn(dobj), "'s reference has been removed.")
60: return player:tell("You may wish to ' <a xch_cmd='", cmd, "'>", cmd, "</a> ' to ensure that no verbs were using this reference.")
61: endif
62: else
63: force_input(player, "help @ref")
64: endif
65: "Last modified by Dax (#789) on Sat Aug 31 10:22:04 2002 MDT."