Manual:DIL Manual/findroom()
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).titledoesn't compile. Put it in a variable first. - A unit variable doesn't keep its value across a
waitorpause; look the room up again afterwards. - To move a character through an exit, use
exec("north", u); uselink()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.