Manual:DIL Manual/speed
Jump to navigation
Jump to search
Contents
speed
Field (integer, read-only; units: characters; also on a cmdptr).
ch.speed : integer c.speed : integer
On a character: the combat speed. Lower is faster: 12 (SPEED_DEFAULT) is one attack per combat round, 4 (SPEED_MIN) is three, and 200 (SPEED_MAX) is the slowest; the constants are in vme.h. A zone file sets it with speed, and affects with APF_SPEED (haste, slow) change it.
On a cmdptr: the command's combat speed, from turns in vme/etc/commands.def; 0 for a command without one.
Notes
- It can't be assigned (vmc: "Illegal lvalue").
- On an object, a room or null it fails.
- change_speed() is something else: it delays a fighting character's next attack and leaves
.speedalone.
Example
dilbegin integer speed_percent(u : unitptr);
var
i : integer;
n : integer;
code
{
i := u.speed;
if (i == SPEED_DEFAULT)
return (100);
if (i < SPEED_MIN)
i := SPEED_MIN;
if (i > SPEED_MAX)
i := SPEED_MAX;
n := (100 * SPEED_DEFAULT) / i;
if (n > 200)
n := 200;
if (n < 25)
n := 25;
return (n);
}
dilend
Turns a character's speed into a percentage of normal speed, as status does in commands.zon.