$MODIFY_CHAR_ATTRIBUTE

DungeonCraft Help Home



$MODIFY_CHAR_ATTRIBUTE(CharNum,<attribute>,modification,durationUnits,duration,text,source)


This function can be used to apply a temporary modification to a character's attributes.  The modification will be removed automatically when the timer expires.

<attribute> = name of the attribute to be modified:
modification = the value by which the attribute is to be changed.  A positive number will make the attribute larger and a negative number will make it smaller.

durationUnits = the units of time (or whatever).
duration = Number of duration units that must elapse before the modification is removed.

text = what should be displayed as the “Spell effect” when the character's spell effects are displayed.  An empty text will cause no display whatsoever.

source – Arbitrary text.  You can use this to identify effects to remove, for example.

Example:

$VAR t;
t = $IndexOf($TargetContext());
$MODIFY_CHAR_ATTRIBUTE(t, “STR”, 5, “MINUTES”, 1440, “More Muscle”, “xx1290b”);

This example would add 5 to the strength of a character and the effect would last for one day.


$REMOVE_CHAR_MODIFICATION



$REMOVE_CHAR_MODIFICATION(CharNum,mask)

Use this function to remove any temporary modifications that were established with the $MODIFIFY_CHAR_ATTRIBUTE function.  This function searches all the modifications and attempts to match the 'source' in each modification with the mask in the $REMOVE_CHAR_MODIFICATIONS.  The comparison is word-by-word with words separated by arbitrary amount of whitespace.  The word “*” in the mask will match any word in the source including missing words at the end of the source.  The mask is assumed to contain an infinite number of “ * ” at its end.  A few examples will make this clear:

1)  a mask of “       abc def” will match a source “abc     def   “
2)  a mask of “Abc” will NOT match a source of “abc”
3)  a mask of “abc * def” will match a source of “abc qwerrty def”
4)  a mask of “abc * *” will match a source of “abc d e”
5)  a mask of “abc   “  will match a source of “abc d e f g h I j”
6)  a mask of “abc def” will NOT match a source of “abcdef”

These are rather minimal rules.  We want to avoid the complications of regular expressions and the need to compile them at runtime.  But we are open to adding additional matching rules if the need arises. Things like “.” matching any character and '#' matching any digit might be useful.  We might even allow an inclusive OR function such that “abc|def” would match either “abc” or “def” but I think this can be more easily handled by having your script try one and then the other.

The function returns “1” if a modification was removed; otherwise the empty string. So, if your script wants to remove all modifications with source of “abc” then it should do something like:  

$WHILE($REMOVE_CHAR_MODIFICATION(char, “abc”){};