PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Object.IsA( POLCLASS_* )

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    PenUltima Online Forum Index -> Feature Suggestions
Display posts from previous:   

Author Message
MontuZ
Distro Developer


Joined: 10 Feb 2006
Posts: 293
Location: Myrtle Beach, South Carolina

PostPosted: Sun May 14, 2006 2:38 am    Post subject: Object.IsA( POLCLASS_* ) Reply with quote

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.

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Sun May 14, 2006 3:51 am    Post subject: Reply with quote

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.

Author Message
Turley



Joined: 05 Feb 2006
Posts: 19

PostPosted: Sun May 14, 2006 7:00 am    Post subject: Reply with quote

Why not:
Code:
If ((object.IsA(POLCLASS_MOBILE)) && (!object.IsA(POLCLASS_NPC)))
..

Wink

Author Message
Zacharias



Joined: 08 Mar 2006
Posts: 16

PostPosted: Sun May 14, 2006 7:50 am    Post subject: Reply with quote

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 Smile

Code:
// 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 Laughing

Author Message
CWO



Joined: 04 Feb 2006
Posts: 685
Location: Chicago, IL USA

PostPosted: Sun May 14, 2006 9:42 am    Post subject: Reply with quote

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...

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Sun May 14, 2006 1:43 pm    Post subject: Reply with quote

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.

Author Message
MontuZ
Distro Developer


Joined: 10 Feb 2006
Posts: 293
Location: Myrtle Beach, South Carolina

PostPosted: Sun May 14, 2006 2:52 pm    Post subject: Reply with quote

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. Smile

Author Message
Marilla



Joined: 02 Feb 2006
Posts: 329

PostPosted: Sun May 14, 2006 10:29 pm    Post subject: Reply with quote

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))

Author Message
Danielle



Joined: 07 Feb 2006
Posts: 97
Location: Pittsburgh, Pennsylvania

PostPosted: Sun May 14, 2006 10:40 pm    Post subject: Reply with quote

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.

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 354
Location: San Diego, California

PostPosted: Sun May 14, 2006 11:01 pm    Post subject: Reply with quote

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

http://wiki.polserver.com/index.php/POL_Object_Class_Reference

Post new topic   This topic is locked: you cannot edit posts or make replies.    PenUltima Online Forum Index -> Feature Suggestions All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty