View/Edit #13:@set*prop

Switch to edit mode.

Name(s): @set*prop
1:  "Syntax:  @set <object>.<prop-name> to <value>"
2:  "Changes the value of the specified object's property to the given value."
3:  "You must have permission to modify the property, either because you own the property or if it is writable."
4:  set_task_perms(player)
5:  iobjstr = player:input_get_raw(iobjstr)
6:  if (this != player)
7:    return player:tell(E_PERM)
8:  elseif (!(l = $code_utils:parse_propref(dobjstr)))
9:    return player:tell("Property ", dobjstr, " not found.")
10: endif
11: dobj = player:my_match_object(l[1], player.location)
12: if ($command_utils:object_match_failed(dobj, l[1]))
13:   return
14: endif
15: prop = l[2]
16: if (prop in $code_utils.builtin_props && !player.wizard)
17:   player:tell("Can't set builtin properties this way.")
18:   player:tell("Use @rename for .name, @move/@eject for .location/.contents, and @chmod for .r, .w and .f")
19:   return
20: endif
21: iobjstr = argstr[$string_utils:word_start(argstr)[prepstr in args][2] + 1..$]
22: iobjstr = $string_utils:trim(iobjstr)
23: propowner = `property_info(dobj, prop)[1] ! ANY'
24: if (!$object_utils:has_property(dobj, prop))
25:   return player:notify("That object does not have that property.")
26: elseif (!iobjstr)
27:   old_val = dobj.(prop)
28:   dobj:("_set_" + prop)("")
29: elseif (iobjstr[1] == "\"")
30:   old_val = dobj.(prop)
31:   dobj:("_set_" + prop)(iobjstr[2..iobjstr[$] == "\"" ? $ - 1 | $])
32: else
33:   val = $string_utils:to_value(iobjstr)
34:   if (!val[1])
35:     return player:tell("[", val[2], "] Could not parse: ", iobjstr)
36:   endif
37:   old_val = dobj.(prop)
38:   dobj:("_set_" + prop)(val[2])
39: endif
40: player:tell("Property ", dobj, ".", prop, equal(old_val, dobj.(prop)) ? " unchanged with value " | " set to ", toliteral(dobj.(prop)), ".")
41: "Last modified by Dax (#789) on Thu Jul 25 11:00:50 2002 MDT."

Verb arguments: any at/to any
Verb perms: Readable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

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