Manual:DIL Manual/getinteger()

From DikuMUD Wiki
Jump to navigation Jump to search

getinteger()

Function (integer). Gets one of several numbers that the server computes, chosen by an index.

getinteger(what : integer, u : unitptr, i : integer)

A way into server calculations that have no function of their own: a character's regeneration, the experience a level needs, the real date and so on. what says which; some take the unit u, some the number i, and the rest ignore both (pass null and 0).

Parameters

Name Type Meaning
what integer Which number, a DIL_GINT_ constant from vme/include/values.h (table below).
u unitptr The unit it is about, or null.
i integer The number it is about, or 0.
what uses gives
DIL_GINT_EFFDEX (0) u The character's effective dexterity: lowered by the armour worn, less so with the skill for that armour.
DIL_GINT_REQXP (1) i The experience needed to reach level i; 0 for 0 or less.
DIL_GINT_LEVELXP (2) i The experience from level i to the next.
DIL_GINT_DESCRIPTOR (3) u 0 when u is a player with no connection (link-dead); 1 for anything else, null too.
DIL_GINT_CRIMENO (4) A new crime serial number.
DIL_GINT_MANAREG (5) u The mana the character regains per regeneration tick.
DIL_GINT_HITREG (6) u The hit points the character regains per regeneration tick.
DIL_GINT_MOVEREG (7) u The endurance the character regains per regeneration tick.
DIL_GINT_BONUS_A (8) i A BONUS_ value (-7 to 7) as a skill bonus, about -20 to +20, with a small random part.
DIL_GINT_BONUS_B (9) i A BONUS_ value as an ability bonus, about -10 to +10, with a small random part.
DIL_GINT_REALYEAR (10) The real year (UTC).
DIL_GINT_REALMONTH (11) The real month, 1 to 12 (UTC).
DIL_GINT_REALDAY (12) The real day of the month (UTC).
DIL_GINT_PRESSURE (13) u The air pressure in millibars in the zone u is in (the zone of the program's own unit when null).
DIL_GINT_PRESSURECHG (14) u How much that pressure changed at the last weather update.

Returns

Integer: the number asked for. The ones about a character give 0 when u is null or not a character. An unknown what fails and is written to the log; a failed argument makes it fail too.

Notes

  • A BONUS_ value outside -7 to 7 is taken as -7 or 7, and logged.

Example

dilbegin integer xp_to_go(pc : unitptr);
var
   need : integer;
code
{
   if (pc.type != UNIT_ST_PC)
      return (0);
   need := getinteger(DIL_GINT_REQXP, null, pc.vlevel + 1);
   if (need <= pc.exp)
      return (0);
   return (need - pc.exp);
}
dilend

Tells how much experience a player still needs for the next level, using the same table as death.zon.

See also