<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Now that I know there is an NPC constant I can see where this would
be an advantage :) I had previously thought that NPC detection was
just completely disabled. I was able to get the sensor to detect
both AGENT and NPC by means of a bitwise OR ( llSensor("", NULL_KEY,
AGENT | NPC, scan_radius, PI); ) which is exactly what I was looking
for.<br>
<br>
In my scripts that utilize sensors I always either tell the script
to hard limit at the 12 (if using a simple menu system to show the
output) closest avatars / whatever other type I've picked, so as not
to or I will utilize a more advanced menu that is capable of
handling more than 12 buttons at a time. Since the sensor limit is
16, would it be wise for me to have the script stop sensing at the
16th avatar... or would it even make much of a difference (at least
"under the hood")? I did manage to successfully get the sensor to
detect with 30 NPC's close by using the advanced menu script and
with the hard limit 12 in my script and I didn't see any apparent
issues with the script or otherwise.<br>
<br>
Just my 2 cents but, as far as actually detecting if an avatar is an
NPC, instead of having llGetOwnerKey() return <span class="st">00000000-0000-0000-0000-<wbr>000000000000</span>
(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 <span class="st">00000000-0000-0000-0000-<wbr>000000000000
for a UUID,</span> 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 <span class="st">00000000-0000-0000-0000-<wbr>000000000000</span>
. 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.<br>
<br>
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)?<br>
<br>
<br>
On 1/19/2012 5:57 PM, Justin Clark-Casey wrote:
<blockquote cite="mid:4F18ADDB.40909@googlemail.com" type="cite">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).
<br>
<br>
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).
<br>
<br>
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).
<br>
<br>
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.
<br>
<br>
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.
<br>
</blockquote>
<pre class="moz-signature" cols="72">--
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</pre>
</body>
</html>