Manual:DIL Manual/target
Jump to navigation
Jump to search
Contents
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. Aftergetanddrop: the item. Afterput: 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);mediumis then the item, already inself'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.
targetis a reserved word, so no variable can be calledtarget; usetgtorvict.
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.