When given a second argument of "on" (or "off"), attempts to lock
(unlock) the specified attribute, as per @atrlock.
+& ATTRIB_SET()
+ attrib_set(<object>/<attrib>[, <value>])
+
+ Sets or clears an attribute. With a value, it sets the attribute,
+ without one, it clears the attribute. This is an easier-to-read
+ replacement for the old set(<object>, <attrib>:<value>) notation,
+ and a less destructive replacement for wipe() that won't destroy
+ entire attribute trees in one shot.
+
+ If there is a second argument, then attrib_set() will create an
+ attribute, even if the second argument is empty (in which case
+ attrib_set() will create an empty attribute). This means that
+ attrib_set(me/foo,%0) will _always_ create an attribute.
+
+ Of course, if the empty_attrs configuration option is turned off,
+ then the above paragraph doesn't apply. See @config attribs.
+
& BAND()
band(<integer>,<integers>,...)
flags, set attributes, and many other things. The two arguments
to the function are the same as the arguments that would appear
on either side of the '=' in @set. This function returns nothing.
-
- Note that you can't clear an attribute with set(), though
- you can make it an empty attribute. Use wipe() to clear attributes.
+
+ The attribute setting ability of set() is deprecated. You should
+ use attrib_set() instead; it's easier to read, and allows you to
+ clear attributes, too.
& SETDIFF()
setdiff(<list1>, <list2>[, <delimiter>][, <sort type>][, <osep>])
& WIPE()
wipe(<obj>/<attribute-pattern>)
- This function is equivalent to @wipe. It returns nothing.
+ This function is equivalent to @wipe. It returns nothing. Like
+ @wipe, this function will destroy entire attribute trees; for
+ more judicious deletion, use attrib_set().
& WORDPOS()
wordpos(<list>, <number>[, <delimiter>])
{"ARABIC2ROMAN", fun_arabictoroman, 1, 1, FN_REG},
{"ART", fun_art, 1, 1, FN_REG},
{"ATRLOCK", fun_atrlock, 1, 2, FN_REG},
+ {"ATTRIB_SET", fun_attrib_set, 1, -2, FN_REG},
{"BAND", fun_band, 1, INT_MAX, FN_REG},
{"BASECONV", fun_baseconv, 3, 3, FN_REG},
{"BEEP", fun_beep, 0, 1, FN_REG},
do_wipe(executor, args[0]);
}
+/* ARGSUSED */
+FUNCTION(fun_attrib_set)
+{
+ dbref thing;
+ char *s;
+
+ if (!FUNCTION_SIDE_EFFECTS) {
+ safe_str(T(e_disabled), buff, bp);
+ return;
+ }
+ if (!command_check_byname(executor, "ATTRIB_SET") || fun->flags & FN_NOSIDEFX) {
+ safe_str(T(e_perm), buff, bp);
+ safe_str(T(e_perm), buff, bp);
+ return;
+ }
+ s = strchr(args[0], '/');
+ if (!s) {
+ safe_str(T("#-1 BAD ARGUMENT FORMAT TO ATTRIB_SET"), buff, bp);
+ return;
+ }
+ *s++ = '\0';
+ thing = match_thing(executor, args[0]);
+ if (!GoodObject(thing)) {
+ safe_str(T(e_notvis), buff, bp);
+ return;
+ }
+ if (nargs == 1) {
+ do_set_atr(thing, s, NULL, executor, 1);
+ } else {
+ do_set_atr(thing, s, args[1], executor, 1);
+ }
+}
+
/* --------------------------------------------------------------------------
* Misc functions: TEL
FUNCTION_PROTO(fun_atan2);
FUNCTION_PROTO(fun_atat);
FUNCTION_PROTO(fun_atrlock);
+FUNCTION_PROTO(fun_attrib_set);
FUNCTION_PROTO(fun_band);
FUNCTION_PROTO(fun_baseconv);
FUNCTION_PROTO(fun_beep);