b49
@verb #13:"@ref*erence" any any any rdo #8084
@program #13:"@ref*erence" any any any
if (player != this)
return $msg:mtell("huh")
elseif (prepstr in {"is", "as"} && !player:isa($prog))
return $msg:mtell("huh")
elseif (prepstr in {"is", "as"})
if ($command_utils:object_match_failed(dobj, dobjstr))
return
elseif (!player:controls(dobj))
return player:tell("You cannot create a reference for an object you do not control.")
endif
if (!iobjstr)
force_input(player, "help @ref")
return
elseif (iobjstr[1] != "$")
return player:tell("All references must begin with '$', like '$", iobjstr, "'.")
elseif (`#0.(iobjstr[2..$]) ! E_PROPNF' != E_PROPNF)
return player:tell("That reference is already in use.")
elseif (!$ref_name_ok(iobjstr[2..$]))
player:tell("The Moo won't understand your reference, as it contains illegal characters.")
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.")
return
endif
x = $ref_db:add_reference(dobj, iobjstr[2..$])
if (x == E_QUOTA)
if (!$cmd_utils:yes_or_no("That object already has a reference. Rename it to " + iobjstr + "?"))
return player:Tell("Not renamed.")
else
old = $find_ref(dobj)
$ref_db:rename_reference(dobj, iobjstr)
player:tell("Renamed.")
cmd = tostr("@grep! ", old, " on #0..", max_object(), ":")
player:tell("You may wish to ' ", cmd, " ' to ensure that no verbs were using this reference.")
endif
else
return player:tell("Reference added, ", iobjstr, " == ", toliteral(dobj), ".")
endif
elseif (iobjstr == "" && prepstr == "")
if ($command_utils:object_match_failed(dobj, dobjstr))
return
elseif (x = $ref_db:has_property_with_value(dobj))
return player:tell($su:nn(dobj), " has the reference '$", x, "'.")
else
if (dobj:ref())
return player:tell($su:nn(dobj), " is corified as ", dobj:ref())
else
return player:tell($su:nn(dobj), " has no reference.")
endif
endif
elseif (iobjstr == "" && dobjstr && prepstr == "off")
old = $find_ref(dobj)
if ($command_utils:object_match_failed(dobj, dobjstr))
return
elseif (!player:controls(dobj))
return player:tell("That's not yours.")
elseif (`$ref_db:remove_reference(dobj) ! E_PROPNF' == E_PROPNF)
return player:tell("That object has no reference.")
else
cmd = tostr("@grep! ", old, " on #0..", max_object(), ":")
player:Tell($su:nn(dobj), "'s reference has been removed.")
return player:tell("You may wish to ' ", cmd, " ' to ensure that no verbs were using this reference.")
endif
else
force_input(player, "help @ref")
endif
"Last modified by Dax (#789) on Sat Aug 31 10:22:04 2002 MDT."
.
0