Manual:DIL Manual/target

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

target

Variable (unitptr, read-only).

target : unitptr

The unit an action in the event was aimed at, when the event has one; otherwise null:

  • SFB_DONE after give: the receiver. After get and drop: the item. After put: the container. After a move: the room entered.
  • SFB_PRE with command(CMD_AUTO_DAMAGE): the victim of the hit. SFB_PRE for a spell: the spell's target.
  • SFB_CMD, SFB_MSG from sendto(), SFB_TICK: null.
  • A send_done() or send_pre() from DIL passes its own target.

Notes

  • The usual give handler waits for command("give") and (target == self); medium is then the item, already in self's inventory.
  • It belongs to the current event: copy it into a variable right after the wait, and secure() the variable if it must outlast a wait or pause.
  • target is a reserved word, so no variable can be called target; use tgt or vict.

Example

dilbegin altar_watch();
code
{
   :start:
   wait(SFB_DONE, command("get") and (medium == self));
   act("The altar glows as $1n takes $2n from it.",
       A_SOMEONE, activator, target, null, TO_ROOM);
   act("The altar glows as you take $2n from it.",
       A_SOMEONE, activator, target, null, TO_CHAR);
   goto start;
}
dilend

An altar (an object with this program) that glows when someone takes something from it: in a get, medium is the container and target the item taken.

See also