Manual:DIL Manual/outside
Jump to navigation
Jump to search
Contents
outside
Field (unitptr, read-only; units: all).
u.outside : unitptr
The unit that u is in: the room a character stands in, the character carrying or wearing an object, the container an object lies in. Null for a room that isn't inside another unit.
Notes
- It can't be assigned (vmc: "Illegal lvalue"). Move a unit with link(), or move a character through an exit with
exec("north", u). - After
exec("<dir>", self), compareself.outsidewith the room before to see whether the move worked. - An object that is worn is still inside its wearer:
outsideis the character, and equip tells where it is worn. - The units inside
uare found with inside and next. - On null it fails.
Example
dilbegin unitptr room_of(u : unitptr);
var
r : unitptr;
code
{
r := u;
while (r)
{
if (r.type == UNIT_ST_ROOM)
return (r);
r := r.outside;
}
return (r);
}
dilend
Finds the room a unit is in, however deep it is packed (a coin in a purse in a sack carried by a player).