Manual:DIL Manual/switched

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

switched

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

ch.switched : unitptr

Who is controlled through a switch:

  • On a player who has switched into an NPC: the NPC the player now controls.
  • On an NPC that a player has switched into: the NPC itself, not the player. So npc.switched != null tells that a player is in it.
  • Otherwise null: a player who hasn't switched, a link-dead player, an NPC no one controls.

Notes

  • On an object or a room it is null; on null it fails.
  • It can't be assigned (vmc: "Illegal lvalue").

Example

dilbegin integer has_player(u : unitptr);
code
{
   if (u.type == UNIT_ST_PC)
      return (TRUE);
   if ((u.type == UNIT_ST_NPC) and (u.switched != null))
      return (TRUE);
   return (FALSE);
}
dilend

Tells whether a player sees through this character, as look checks in baselook.zon.

See also