Manual:DIL Manual/setbright()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:22, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setbright()

Procedure. Sets how much light a unit gives.

setbright(u : unitptr, light : integer)

Sets the bright value of u, the light it sheds, and changes the light around it by the same amount: the room or container it is in, and a character who wears or holds it. A torch with 1 or more lights up a dark room; a negative value darkens. The bright field can't be assigned; this is how it is changed.

Parameters

Name Type Meaning
u unitptr The unit.
light integer The new light value.

Notes

  • Works on every kind of unit. With a null unit nothing happens.
  • The value is a 16-bit number: outside -32768 to 32767 it wraps around.
  • The light inside a unit is the light field; whether a room can be seen in, islight().

Example

dilbegin burn_down(minutes : integer);
code
{
   heartbeat := PULSE_SEC * 60;
   setbright(self, 2);
   while (minutes > 0)
   {
      pause;
      minutes := minutes - 1;
   }
   setbright(self, 0);
   quit;
}
dilend

A torch that burns for a given number of minutes and then goes out.

See also