the npc character's problem can be solved like this
NPC Code:
for (i=0; i<playerscount; i++) {
if (players[i].id>=0) {
this.players++;
}
}
of course the "this.players" variable would have to be reset to zero before called. and the variable "this.players" everytime would equal to the amount of "real players" in the room.