PenUltima Online

It is currently Thu Aug 28, 2008 9:50 pm

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: Object.IsA( POLCLASS_* )
PostPosted: Sat May 13, 2006 10:38 pm 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 13, 2006 11:51 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 3:00 am 
Offline
POL Core Developer

Joined: Sun Feb 05, 2006 4:45 am
Posts: 30
Why not:
Code:
If ((object.IsA(POLCLASS_MOBILE)) && (!object.IsA(POLCLASS_NPC)))
..

;)


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 3:50 am 
Offline

Joined: Wed Mar 08, 2006 7:30 am
Posts: 16
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:
// 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:


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 5:42 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
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...


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 9:43 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 10:52 am 
Offline
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
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. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 6:29 pm 
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))


Top
  
 
 Post subject:
PostPosted: Sun May 14, 2006 6:40 pm 
Offline

Joined: Tue Feb 07, 2006 3:32 pm
Posts: 97
Location: Pittsburgh, Pennsylvania
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.

_________________
Image
Image <-- 50% off setup fees! Use PromoCode "NIGHTSCAPE"


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 7:01 pm 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 398
Location: San Diego, California
Think of the class heirarchy.. then look at the POLCLASS_* flags

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

_________________
-Austin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl