Manual:DIL Manual/aware
Jump to navigation
Jump to search
Contents
aware
Keyword. Option of dilbegin: the program also hears what its own unit does.
dilbegin aware name(...);
Normally a program is not woken by events its own unit causes: when the activator is the unit the program sits on, the event passes it by. A program on an NPC doesn't see the commands that NPC gives (also through exec), and a program on a player doesn't see what the player types. With aware the program gets those events too.
Notes
- It only concerns events whose activator is the program's own unit, so in practice programs on characters: commands it gives (
SFB_CMD,SFB_DONE), messages it sends withsend(), and the like. A program on an object or a room hears the characters around it withoutaware. - Some events always reach the unit's own programs: messages sent to it with
sendto(), the character's own death (SFB_DEAD), ticks, and the prompt. - An
awareprogram on a player that waits forSFB_CMDwakes at every command the player types; testactivator == selfand the command early and go back to waiting. - The option is stored in each copy when it is made: adding or removing it doesn't change copies already saved on players' things.
Example
dilbegin aware vow_silence();
code
{
:start:
wait(SFB_CMD, (activator == self) and (command("say") or command("shout")));
act("You remember your vow of silence and hold your tongue.",
A_ALWAYS, self, null, null, TO_CHAR);
block;
goto start;
}
dilend
Copied onto a player, it stops the player's own say and shout. Without aware it would never wake.