Manual:DIL Manual/charflags
Jump to navigation
Jump to search
Contents
charflags
Field (integer, read/write; units: characters).
ch.charflags : integer
The character flags: a bit field of CHAR_* values, defined in vme.h. Among them CHAR_PROTECTED, CHAR_LEGAL_TARGET, CHAR_OUTLAW, CHAR_BLIND, CHAR_HIDE, CHAR_MUTE, CHAR_SNEAK, the CHAR_DETECT_* flags, CHAR_WIMPY, CHAR_PEACEFUL and CHAR_KILL_SELF. A zone file gives a mobile its flags with romflags {...}.
Test a flag with isset(), and change it with set() and unset().
Notes
- Players and NPCs. On an object, a room or null the field fails.
- Many of these flags come from affects (
APF_MOD_CHAR_FLAGS, e.g. sneak, hide, the detect spells). When such an affect ends it removes its flag, even if a program had set the same flag; then every remaining affect of that kind sets its flag again. A flag set by DIL therefore doesn't last if an affect for the same flag comes and goes. - Assigning the whole field replaces every flag.
Example
dilbegin string law_status(u : unitptr);
var
s : string;
code
{
s := "";
if (isset(u.charflags, CHAR_PROTECTED))
s := "protected";
if (isset(u.charflags, CHAR_OUTLAW))
s := s + " outlaw";
if (isset(u.charflags, CHAR_LEGAL_TARGET))
s := s + " legal target";
return (s);
}
dilend
Describes a character's standing with the law, as look does in baselook.zon.