Manual:DIL Manual/value
Jump to navigation
Jump to search
Contents
value
Field (integer, read/write; units: objects).
obj.value[i] : integer
The object's five numbers, value[0] to value[4], set with value[i] lines in the zone file. What they mean depends on the objecttype; the macros in wmacros.h show it. For example:
ITEM_LIGHT(LIGHT_DEF): value[0] hours left to burn (INFINITE_BURNTIME, -1, for ever), value[1] how bright.ITEM_DRINKCON(LIQ_DEF): value[0] how much liquid is in it (the most is the capacity), value[3] poison.ITEM_FOOD(FOOD_DEF): value[0] how filling, value[3] poison.- Potions, scrolls, wands and staffs: value[0] the spell power.
(The table in the comments of vme.h for ITEM_DRINKCON is out of date; LIQ_DEF is what the zones use.)
Notes
- Objects only. On a character, a room or null, or with an index outside 0 to 4, it fails.
- Values are signed 32-bit numbers.
- Changing the liquid in a drink container doesn't change its weight: use set_weight() as well.
Example
dilbegin refill(lamp : unitptr, hours : integer);
code
{
if ((lamp.type != UNIT_ST_OBJ) or (lamp.objecttype != ITEM_LIGHT))
return;
if (lamp.value[0] == INFINITE_BURNTIME)
return;
lamp.value[0] := lamp.value[0] + hours;
return;
}
dilend
Adds hours of fuel to a lamp unless it burns for ever.