Manual:DIL Manual/alignment
Jump to navigation
Jump to search
Contents
alignment
Field (integer, read/write; units: all).
u.alignment : integer
How good or evil the unit is, from -1000 (evil) to 1000 (good). The macros in wmacros.h draw the lines: IS_GOOD(a) is 350 and up, IS_EVIL(a) -350 and down, IS_NEUTRAL(a) in between. Objects and rooms have an alignment too (detect alignment shows an object's aura from it in baselook.zon).
Notes
- Assigning isn't clamped: the zone compiler keeps alignments within -1000 to 1000, but DIL can store anything from -32768 to 32767 (a 16-bit number; beyond that it wraps). Keep it in range yourself.
- On null it fails.
Example
dilbegin string aura(u : unitptr);
code
{
if (u.alignment >= 350)
return ("blue");
else if (u.alignment <= -350)
return ("red");
return ("green");
}
dilend
The colour of a unit's aura, as get_aura in baselook.zon.