Object.IsA( POLCLASS_* )

Archive of the older Feature Request Forum Posts

Moderator: POL Developer

Locked
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Object.IsA( POLCLASS_* )

Post 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.
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm
Location: Nederland, Texas

Post 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.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Post by Turley »

Why not:

Code: Select all

If ((object.IsA(POLCLASS_MOBILE)) && (!object.IsA(POLCLASS_NPC)))
..
;)
Zacharias
New User
Posts: 16
Joined: Wed Mar 08, 2006 7:30 am

Post 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:
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post 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...
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm
Location: Nederland, Texas

Post 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.
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Post 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. :)
Marilla

Post 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))
Danielle
Grandmaster Poster
Posts: 104
Joined: Tue Feb 07, 2006 3:32 pm
Location: Pittsburgh, Pennsylvania

Post 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.
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

Think of the class heirarchy.. then look at the POLCLASS_* flags

http://wiki.polserver.com/index.php/POL ... _Reference
Locked