Manual:DIL Manual/descr
Jump to navigation
Jump to search
Contents
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$xextra. Make one with addextra(). - Extra variables are null again after every
waitorpause: 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.