Manual:DIL Manual/hometown

From DikuMUD Wiki
Jump to navigation Jump to search

hometown

Field (string, read/write; units: PC).

pc.hometown : string

The symbolic name of the player's home room, such as "temple@udgaard". The game puts the player there when entering the game with no saved room to return to, and when a dead player's spirit comes back. If the string doesn't name a room, the server uses its default entry room instead. A new player gets "temple@udgaard" from basis.zon; clans.zon changes it when a player joins or leaves a clan.

Notes

  • Players only. On an NPC, an object, a room or null the field fails.
  • Any zone can assign it. Nothing checks the value: assign the name of a room that exists. Assigning "" or null leaves the player without a hometown, so the default entry room is used.
  • It is saved with the player.
  • To get the room, use findroom(pc.hometown); it returns null when there is no such room.

Example

dilbegin send_home(pc : unitptr);
var
   room : unitptr;
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   room := findroom(pc.hometown);
   if (room == null)
      room := findroom("temple@udgaard");
   if (pc.outside != room)
      link(pc, room);
}
dilend

Moves a player to the home room, or to the Udgaard temple when the hometown is not a room, as death.zon does with a returning spirit.

See also