Manual:DIL Manual/extra
Jump to navigation
Jump to search
extra
Field (extraptr, read-only; units: all).
u.extra : extraptr
The first of the unit's extra descriptions, or null when it has none. Each one has names, a text (descr) and a list of numbers (vals); next gives the one after it.
Players see the extras on look at. Extras whose name starts with $ are hidden, and DIL uses them to keep data on a unit: quest flags, counters, names.
Finding an extra
"$name" in u.extraandu.extra.["$name"]both give the first extra with that name (case is ignored; any of its names counts), or null.- An extra without names is found with
"".
Notes
- It can't be assigned (vmc: "Illegal lvalue"). Add extras with addextra() and remove them with subextra(); change one through its fields.
addextra(u.extra, {"$x"}, "")adds nothing: an extra made in DIL needs some text.- Every extraptr variable is null again after a
waitorpause, and extras can't be secured: look the extra up again after waiting. - A player's administrative extras are in info, not here.
- On null it fails.
Example
dilbegin list_extras(u : unitptr);
var
exd : extraptr;
code
{
exd := u.extra;
while (exd)
{
sendtext(exd.name + ": " + exd.descr + "<br/>", self);
exd := exd.next;
}
quit;
}
dilend
Lists the name and text of every extra description on a unit.