I'll take a shot at these from a perspective of having used most of them in sl scripts<br><br>
<div class="gmail_quote">On Mon, Jun 16, 2008 at 11:54 PM, Mike Mazur <<a href="mailto:mmazur@gmail.com">mmazur@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello,<br><br>I'm trying to wrap my head around how llDetected* functions work in<br>OpenSim.<br><br>Here's what I know so far:<br>
- these functions tell you something about either a prim/object or<br>avatar<br>- they only apply in certain events (collision{,_start,_end},<br>touch{,_start,_end} and sensor)<br>- they take a number as an argument which is an index of the object<br>
<br>I may have some of that mixed up a bit...</blockquote>
<div> </div>
<div>seems ok so far...</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br><br>I traced through the code for touch_start to try to figure this out.<br>First, in<br>
OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs<br>line 119 the touch_start function is executed and an llDetectParams<br>struct is filled in. The arrays in the struct are all 1 in size, and<br>are filled with some values.<br>
<br>What exactly do these values represent? According to<br>OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs<br>line 152, _key is "detected key" and _key2 is "owner key". What are<br>
these exactly? The position, velocity, rotation and _string (name)<br>properties make sense, but the _bool and _int ones don't.</blockquote>
<div> </div>
<div>llDetectedKey() returns the UUID of the agent (avatar) or object that was detected</div>
<div>llDetectedOwner() returns the UUID of the owner of the object that was detected.</div>
<div>I dont know of any llDetected() functions that return booleans.</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br><br>This llDetectParams struct is then assigned to the script, and accessed<br>in OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs in<br>
functions llDetectedName() (line 554), uuidDetectedKey() (line 595) and<br>entityDetectedKey() (line 632).<br><br>The number argument to each of those functions is used to index the<br>arrays in the llDetectParams struct (_key, _key2, etc). This array is<br>
always initialized to size 1. Is the number argument ever not 0? Do<br>those arrays inside the llDetectParams struct ever grow or shrink.<br><br>Also, how does the event that is triggered affect the number passed in?<br>Is it different for collosion_start and touch_start for instance?</blockquote>

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

<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br><br>Finally, which object is usually referred to in those llDetected*<br>functions? For example, if I have a box with a script that calls<br>
llDetectedVel() in its touch_start event, will llDetectedVel return the<br>velocity of the box at the instant it is touched by an avatar? Or maybe<br>it's the velocity of the avatar?</blockquote>
<div> </div>
<div>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().</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br><br>A lot of questions, but here's hoping someone can clear this up a bit<br>further.<br>
</blockquote>
<div> </div>
<div>Take a look at <a href="http://lslwiki.net">lslwiki.net</a> or <a href="http://wiki.secondlife.com">wiki.secondlife.com</a> for documentation on these functions.  Good luck!</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br>Thanks,<br>Mike<br>_______________________________________________<br>Opensim-dev mailing list<br>
<a href="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</a><br><a href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target="_blank">https://lists.berlios.de/mailman/listinfo/opensim-dev</a><br>
</blockquote></div><br>