QUERY_NPC(L)
NAME
query_npc - determine if living object is an NPC
SYNOPSIS
int query_npc
LOCATION
/obj/living.c
RETURN VALUE
A zero value means the object is either a player or does not
have the 'npc' variable set. A non-zero value means object is
an NPC (Non-Player Character, a role-playing term).
NOTES
This is not always reliable. A wizard can easily (by design or by
mistake) create a monster who does not have the npc variable set
to a true value. The preferred method of testing if a living is
a player is to use the external function interactive().
interactive(object) will determine whether the object has a player
behind it typing away at a keyboard, or does not.
EXAMPLES
int enter_castle(string str) {
if( this_player()->query_npc() ) {
write("The guard stops "+this_player()->query_name()+".\n"+
"The guard says: No NPC's allowed in here.\n");
return 1;
}
...
}
SEE ALSO
interactive(E), living(E)
Help topics available:
You are guest number 118 since March 2020.
This file was last modified: June 2000.