Manual:DIL Manual/opponentcount
Jump to navigation
Jump to search
Contents
opponentcount
Field (integer, read-only; units: characters).
ch.opponentcount : integer
How many characters this one is in combat with. Combat goes both ways: when A attacks B, each is on the other's list, so it counts both the ones it attacks and the ones attacking it. 0 when it isn't fighting. The one it actually hits is fighting; getopponent(ch, i) gives each of them, i from 0 to opponentcount - 1.
Notes
- Read-only: vmc refuses an assignment ("Illegal lvalue").
- On an object, a room or null it fails.
Example
dilbegin list_foes(ch : unitptr);
var
i : integer;
u : unitptr;
code
{
i := 0;
while (i < ch.opponentcount)
{
u := getopponent(ch, i);
if (u != null)
act("You are fighting $2n.", A_ALWAYS, ch, u, null, TO_CHAR);
i := i + 1;
}
return;
}
dilend
Tells a character everyone it is fighting.