Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Detect Avatar Collisions Only?

Kristian Ming
Head Like A Hole
Join date: 5 Feb 2005
Posts: 404
03-19-2007 06:25
My lsl has gotten rusty, and it wasn't spectacular to begin with. Does anyone know if this script fragment will fire if and only if an avatar collides with the prim? I'm trying to build a collision door but don't want stray bullets opening it up.

CODE
    collision(integer total_number)
{
if (1 == llDetectedType(0)) {
llMessageLinked(LINK_ROOT, collisioncode, (string)collisioncode, llDetectedKey(0));
}
}
_____________________
"When you're going through hell, keep going!" -- Winston Churchill
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
03-19-2007 07:28
I would replace this:

CODE
if (1 == llDetectedType(0)) {


with this:

CODE
if(llDetectedType(0) & AGENT) {


That's what I've been using and I know it works correctly. It might do the same exact thing as your example.

-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-19-2007 07:31
I'd use AGENT instead but yes should work.
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
03-19-2007 08:08
From: Atashi Toshihiko
I would replace this:

CODE
if (1 == llDetectedType(0)) {


with this:

CODE
if(llDetectedType(0) & AGENT) {


That's what I've been using and I know it works correctly. It might do the same exact thing as your example.


Keep on mind depending on exact value of AGENT and other types these two snippets may not give identical results. Binary AND will return positive value even with single bit shared between DetectedType and AGENT, while comparison will only return true if these two values are identical.

It won't be problem in this particular case since detected types use unique bit each iirc, but just something to watch for ^^;;