[Opensim-dev] Trying to understand llDetected* functions

Dahlia Trimble dahliatrimble at gmail.com
Tue Jun 17 07:23:57 UTC 2008


I'll take a shot at these from a perspective of having used most of them in
sl scripts

On Mon, Jun 16, 2008 at 11:54 PM, Mike Mazur <mmazur at gmail.com> wrote:

> Hello,
>
> I'm trying to wrap my head around how llDetected* functions work in
> OpenSim.
>
> Here's what I know so far:
> - these functions tell you something about either a prim/object or
> avatar
> - they only apply in certain events (collision{,_start,_end},
> touch{,_start,_end} and sensor)
> - they take a number as an argument which is an index of the object
>
> I may have some of that mixed up a bit...


seems ok so far...


>
>
> I traced through the code for touch_start to try to figure this out.
> First, in
> OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
> line 119 the touch_start function is executed and an llDetectParams
> struct is filled in. The arrays in the struct are all 1 in size, and
> are filled with some values.
>
> What exactly do these values represent? According to
> OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
> line 152, _key is "detected key" and _key2 is "owner key". What are
> these exactly? The position, velocity, rotation and _string (name)
> properties make sense, but the _bool and _int ones don't.


llDetectedKey() returns the UUID of the agent (avatar) or object that was
detected
llDetectedOwner() returns the UUID of the owner of the object that was
detected.
I dont know of any llDetected() functions that return booleans.

>
>
> This llDetectParams struct is then assigned to the script, and accessed
> in OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs in
> functions llDetectedName() (line 554), uuidDetectedKey() (line 595) and
> entityDetectedKey() (line 632).
>
> The number argument to each of those functions is used to index the
> arrays in the llDetectParams struct (_key, _key2, etc). This array is
> always initialized to size 1. Is the number argument ever not 0? Do
> those arrays inside the llDetectParams struct ever grow or shrink.
>
> Also, how does the event that is triggered affect the number passed in?
> Is it different for collosion_start and touch_start for instance?


The number may be larger for sensor scans or collisions, but is usually 1
for touches. The sensor(), touch_start(), and other events have a
num_detected parameter which should indicate the number of agents/objects
that are available for the llDetected() functions to index.

>
>
> Finally, which object is usually referred to in those llDetected*
> functions? For example, if I have a box with a script that calls
> llDetectedVel() in its touch_start event, will llDetectedVel return the
> velocity of the box at the instant it is touched by an avatar? Or maybe
> it's the velocity of the avatar?


in that case it would be the velocity of the agent which touched the box. If
you want the velocity of the box itself, use llGetVel().


>
>
> A lot of questions, but here's hoping someone can clear this up a bit
> further.
>

Take a look at lslwiki.net or wiki.secondlife.com for documentation on these
functions.  Good luck!


>
> Thanks,
> Mike
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080617/86648dfe/attachment-0001.html>


More information about the Opensim-dev mailing list