Manual:DIL Manual/loadcount
Jump to navigation
Jump to search
Contents
loadcount
Field (integer, read-only; units: all).
u.loadcount : integer
How many units made from the same definition (the same nameidx@zoneidx) are in the game right now, this one included. Use it to keep a load from running away.
Notes
- A unit with no definition behind it gives 1.
- It can't be assigned (vmc: "Illegal lvalue").
- On null it fails.
Example
dilbegin give_bag();
var
gift : unitptr;
code
{
gift := load("tot_bag2@hallows23");
if (gift == null)
quit;
if (gift.loadcount > 250)
{
destroy(gift);
quit;
}
link(gift, self);
quit;
}
dilend
Loads a bag and throws it away again when there are more than 250 of them, as in hallows23.zon.