Page 1 of 1
Object.IsA( POLCLASS_* )
Posted: Sat May 13, 2006 10:38 pm
by MontuZ
Maybe add a new const to determine if it's a PC or not.
POLCLASS_MOBILE - Returns true if object is a PC/NPC.
POLCLASS_NPC - Returns true if object is a NPC.
POLCLASS_PC - Returns true if object is a PC.
Just a suggestion, lol.
Posted: Sat May 13, 2006 11:51 pm
by tekproxy
That would be neat. Because right now I'm not sure if I should use ip or acct to determine if it's a PC or not.
Posted: Sun May 14, 2006 3:00 am
by Turley
Why not:
Code: Select all
If ((object.IsA(POLCLASS_MOBILE)) && (!object.IsA(POLCLASS_NPC)))
..

Posted: Sun May 14, 2006 3:50 am
by Zacharias
why not script a own function is_pc(), is_npc or is_mobile()?
if there are changes (e.g. npcs get a ip / acct-prop :p . don't know why) you could easy modify that.
No need for a new constant, in my opinion.
Edit:
oops
Code: Select all
// POLCLASS_* constants - use with obj.isa(POLCLASS_*)
const POLCLASS_UOBJECT := 1;
const POLCLASS_ITEM := 2;
const POLCLASS_MOBILE := 3;
const POLCLASS_NPC := 4;
const POLCLASS_LOCKABLE := 5;
const POLCLASS_CONTAINER := 6;
const POLCLASS_CORPSE := 7;
const POLCLASS_DOOR := 8;
const POLCLASS_SPELLBOOK := 9;
const POLCLASS_MAP := 10;
const POLCLASS_MULTI := 11;
const POLCLASS_BOAT := 12;
const POLCLASS_HOUSE := 13;
const POLCLASS_EQUIPMENT := 14;
const POLCLASS_ARMOR := 15;
const POLCLASS_WEAPON := 16;
already exists in uo.em. how unnecessary :lol:
Posted: Sun May 14, 2006 5:42 am
by CWO
umm even better, if you wanna know its a PC, all you need to do is one check...
if (mobile.acctname)
NPCs dont have accounts...
Posted: Sun May 14, 2006 9:43 am
by tekproxy
There are many properties that a character has that a NPC doesn't have and I think everyone knows them... Why have POLCLASS_NPC when you have object.npctemplate ? Haha.
Posted: Sun May 14, 2006 10:52 am
by MontuZ
tekproxy wrote:There are many properties that a character has that a NPC doesn't have and I think everyone knows them... Why have POLCLASS_NPC when you have object.npctemplate ? Haha.
My point exactly. But you never know, there could be a valid reason why it was never added. When a dev gets a chance they'll give us an answer, maybe.

Posted: Sun May 14, 2006 6:29 pm
by Marilla
I thought the answer was already posted above: There are already lots of ways to tell... npctemplate, which no PC has, or ip or acctname, which no NPC has. Or just test for ISA(POLCLASS_MOBILE) && (!ISA(POLCLASS_NPC))
Posted: Sun May 14, 2006 6:40 pm
by Danielle
I think this is one of those requests where, "Yes, there are ways to do it, but why not simplify it by adding this flag?"
Kinda like how you could use pc.ip to test for connection, but we got pc.connected anyway.
These kind of features are really useful to those new to escript (and especially programming in general) and do not know all the work-around methods posted here.
Posted: Sun May 14, 2006 7:01 pm
by Austin
Think of the class heirarchy.. then look at the POLCLASS_* flags
http://wiki.polserver.com/index.php/POL ... _Reference