Manual:DIL Manual/lastroom

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

lastroom

Field (unitptr, read-only; units: PC).

pc.lastroom : unitptr

Meant to give the room the server will put the player back in: the room the player was in when last saved, or when the connection was lost. When a player enters the game the server moves the player there and clears it; with no such room the player starts in the hometown. It is not the room the player just walked out of.

Broken: reading this field crashes the server or gives a bad unit. The interpreter takes the room itself for the address of the pointer to it (vme/src/dilfld.cpp, DILF_LASTROOM). Don't use it until that is fixed.

Notes

  • Players only. On an NPC, an object, a room or null the field fails.
  • It can't be assigned (vmc: "Illegal lvalue").
  • No zone in the game uses it.

Example

dilbegin integer back_in_saved(pc : unitptr);
code
{
   if (pc.type != UNIT_ST_PC)
      return (FALSE);
   return (pc.outside == pc.lastroom);
}
dilend

Would tell whether a player is in the room the game saved for the player. Don't run it while the field is broken.

See also