An NPC flag is already kept, so there's no need to do any useraccount lookups.

On reflection, I'm not sure that llGetOwnerKey() returning UUID.Zero for 'unowned' avatars is really a problem. The case in which this already happens is if the key is malformed. But if you have received this from a sensor you know that the uuid is valid.

Still, I think it would be good to have another more intuitive means of knowing a given agent is an NPC. Possibly llGetAgentInfo() could return an AGENT_IS_OS_NPC in the flags.

As for sensing, I think I'll have to go with OS_NPC_SENSE_AS_AGENT (sorry for the long name, Chris). I'm still not really convinced that this really makes sense but it's very difficult to say without having it in the wild. The worse that can happen is that the majority of people writing NPC scripts will have to remember to set this flag.

Just my 2 cents but, as far as actually detecting if an avatar is an NPC, 
instead of having llGetOwnerKey() return
00000000-0000-0000-0000-000000000000 (I'm assuming that is essentially what 
UUID.Zero is in the server code) would it be
possible to do a simple check routine against the UUID's in the useraccounts 
table? If the ID does not exist then it
must be an NPC; if it does exist then it's an AGENT? Not sure how efficient 
this would be though if the useraccounts
table is rather large... Or perhaps put a flag (transparent to the viewer) on 
each NPC created and have the code check
for this flag each time it needs to deal with a targeted NPC; if the flag is 
there then it's an NPC, and vice versa.
Reason I ask is, it's not so much as the sensor having issues dealing with an 
avatar that has
00000000-0000-0000-0000-000000000000 for a UUID, but the rest of the code 
actually having to deal with that number for
an avatar's key. Like a poseball script for example, most of them are coded to 
assume that no one is sitting on it if
the avatar key is NULL_KEY, therefore I would think that it would really 
confuse the script if the NPC was directed to
sit on the poseball and its key is 00000000-0000-0000-0000-000000000000 . This 
is just a simple example but I have ran
into problems with more complex scripts that utilize a list of owners in order 
to determine if an avatar is able to have
access to its functions and the avatar being NULL_KEY.

I think having a OS_NPC_SHOW_AS_AGENT (or perhaps maybe OS_NPC_AS_AGENT just to 
keep things short and sweet? :) ) option
to the npc create command would be a good idea and a handy option to keep 
compatibility with older sensor scripts
(especially ones that are no mod and can't be changed to include the NPC type) 
if it would allow the NPC's actual UUID
to be seen by script(s)?


On 1/19/2012 5:57 PM, Justin Clark-Casey wrote:
This is indeed correct. It means that sensors using the LSL AGENT type will not 
detect NPCs. To detect an NPC you must
specify the currently OpenSim-only NPC constant. This has been true since 
7518b07 (Fri Jan 6 22:35:06 2012).

One reason for doing this is because the sensor limit is 16 and one doesn't 
want the return to be overwhelmed by NPCs.
It means that sensor using scripts not designed with NPCs in mind (both in the 
past and the future) won't work with
NPCs without alteration. It strikes me that sometimes this is a disadvantage 
(e.g. a light that should come on when it
detects any presence) but for other items an advantage (e.g. non-NPC aware 
radars that wouldn't be designed to pick
them up anyway).

So one option is to change the default so that AGENT will pick up NPCs. 
However, this is a problem with the 16 avatar
sensor limit. Even if this is turned up, it might then cause script problems 
(e.g. ones designed to work with only 16
avatars).

Another slightly messy option is to provide something like an 
OS_NPC_SHOW_AS_AGENT option to osNpcCreate() that will
show such NPCs as agents. I'm favouring this option right now.

Either way, what is missing at the moment is a way to actually tell if a 
particular agent is an NPC. One possibility
is to make llGetOwnerKey() return an owned NPC's owner. For an unowned NPC, 
this would need to return UUID.Zero - I'm
not sure if there's a problem disambiguating between an unowned NPC and a 
situation where no entity with the ID is found.
--
OpenSim: 9 Region Standalone on 0.7.3 Dev
Physics: Open Dynamics Engine
OS: Windows XP 32 Bit
CPU: AMD Phenom II X4 840 3.2 GHz
Memory: 3 GB DDR3
Database: MySQL 5.1.11



_______________________________________________
Opensim-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/opensim-users


--
Justin Clark-Casey (justincc)
http://justincc.org/blog
http://twitter.com/justincc
_______________________________________________
Opensim-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/opensim-users

Reply via email to