Switch to edit mode.
Name(s): @newmess*age1: "Usage: @message <message-name> [<message>] [on <object>]"
2: "Add a message property to an object (default is player), and optionally set its value. For use by non-programmers, who aren't allowed to add properties generally."
3: "To undo the effects of this, use @unmessage."
4: set_task_perms(player)
5: dobjwords = $string_utils:words(dobjstr)
6: if (!dobjwords)
7: player:notify(tostr("Usage: ", verb, " <message-name> [<message>] [on <object>]"))
8: return
9: endif
10: object = valid(iobj) ? iobj | player
11: name = this:_messagify(dobjwords[1])
12: value = dobjstr[length(dobjwords[1]) + 2..$]
13: nickname = "@" + name[5..$]
14: e = add_property(object, name, value, {this, "rc"})
15: if (typeof(e) != $ERR)
16: player:notify(tostr(nickname, " on ", object.name, " is now \"", object.(name), "\"."))
17: elseif (e != E_INVARG)
18: player:notify(tostr(e))
19: elseif ($object_utils:has_property(object, name))
20: "object already has property"
21: player:notify(tostr(object.name, " already has a ", nickname, " message."))
22: else
23: player:notify(tostr("Unable to add ", nickname, " message to ", object.name, ": ", e))
24: endif
25: "Last modified by Dax (#789) on Wed May 4 06:46:28 2005 MDT."