Manual:DIL Manual/findroom()

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

findroom()

Function (unitptr). Finds a room by its symbolic name.

findroom(sym : string) : unitptr

Returns the room defined as sym, "name@zone", for example to move someone there with link().

Parameters

Name Type Meaning
sym string The room's symbolic name, "name@zone" (or "zone/name"). Case doesn't matter.

Returns

The room, or null when there is no room of that name: an unknown zone or name, a name without @zone, or the symbolic name of an NPC or object.

Notes

  • The result can't take a field directly: findroom(s).title doesn't compile. Put it in a variable first.
  • A unit variable doesn't keep its value across a wait or pause; look the room up again afterwards.
  • To move a character through an exit, use exec("north", u); use link() with findroom where no exit leads.

Example

dilbegin to_temple(pc : unitptr);
var
   rm : unitptr;
code
{
   rm := findroom("temple@udgaard");
   if (rm == null)
   {
      log("to_temple: no temple@udgaard");
      quit;
   }
   act("$1n disappears in a flash of light.", A_SOMEONE, pc, null, null, TO_ROOM);
   link(pc, rm);
   act("$1n appears in a flash of light.", A_SOMEONE, pc, null, null, TO_ROOM);
   quit;
}
dilend

Moves a character to the temple of Udgaard, as death.zon does.

See also