Manual:DIL Manual/descr

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:10, 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

descr

Field (string, read/write; on extraptr).

e.descr : string

The text of an extra description: what a player sees on look at the extra's name. Extras the game keeps for itself (names starting with $) often keep data in it, such as a time or a name.

Units have no descr field: theirs are outside_descr and inside_descr (vmc: "Illegal type for field"). The descr keyword in a zone file sets one of those two.

Notes

  • Assigning a string replaces the text; assigning null or "" empties it.
  • On null it fails, and an assignment to it does nothing: u.extra.["$x"].descr := "a"; adds nothing when the unit has no $x extra. Make one with addextra().
  • Extra variables are null again after every wait or pause: look the extra up again after waiting.

Example

dilbegin last_visitor();
var
   exd : extraptr;
code
{
   heartbeat := PULSE_SEC * 4;
   :start:
   wait(SFB_DONE, command(CMD_AUTO_ENTER) and (activator.type == UNIT_ST_PC));
   exd := "$last_visitor" in self.extra;
   if (exd == null)
      addextra(self.extra, {"$last_visitor"}, activator.name);
   else
      exd.descr := activator.name;
   goto start;
}
dilend

Keeps the name of the last player to come in, in a hidden extra on the unit.

See also