Manual:DIL Manual/type
Jump to navigation
Jump to search
Contents
type
Field (integer, read-only; units: all; also on a cmdptr).
u.type : integer c.type : integer
On a unit: what kind of unit it is, one of the constants in vme.h:
| Constant | Value |
|---|---|
UNIT_ST_NPC |
1 |
UNIT_ST_PC |
2 |
UNIT_ST_ROOM |
4 |
UNIT_ST_OBJ |
8 |
On a cmdptr: the command's type in vme/etc/commands.def: TYPE_SOCIAL (1) or TYPE_SKILL (2) from values.h, or 0 for an ordinary command.
Notes
- On null it fails, and a failed value is false in every comparison:
u.type != UNIT_ST_PCis false too whenuis null. Testu == nullfirst. - It can't be assigned (vmc: "Illegal lvalue"). Not on a zoneptr or extraptr (vmc: "Illegal type for field").
- For an object's kind (weapon, armour, container...) use objecttype.
Example
dilbegin list_commands();
var
c : cmdptr;
sl : stringlist;
code
{
c := chead();
while (c)
{
if ((c.level <= self.level) and (c.type != TYPE_SOCIAL) and (c.type != TYPE_SKILL))
addstring(sl, c.name);
c := c.next;
}
pagestring(itoa(length(sl)) + " commands.<br/>", self);
quit;
}
dilend
Counts the commands a character may use that are neither socials nor skills, as commands does in commands.zon.