Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

quick question

Jaser Newell
Registered User
Join date: 12 Sep 2006
Posts: 23
03-06-2007 14:08
is there anything wrong with the following bit of code.
CODE

collision_start(integer x)
{
if(llDetectedType(0) == AGENT)
{
llSay(0, llDetectedName(0) + " has been hit.");
}
}
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
03-06-2007 14:12
llDetectedType(0) & AGENT
is preferable to
llDetectedType(0) == AGENT
, because llDetectedType will return a bitmask
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
03-06-2007 14:12
From: Jaser Newell
is there anything wrong with the following bit of code.

Yep!

Try this instead..
CODE

collision_start(integer x)
{
if(llDetectedType(0) & AGENT)
{
llSay(0, llDetectedName(0) + " has been hit.");
}
}

I just changed the '==AGENT' to be '& ANGENT' because llDetectedType is a bitfield and I'm guessing you want to see if that one bit (AGENT) is set, not if that's the only one that's set..
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
03-06-2007 14:12
See: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDetectedType

CODE
collision_start(integer x)
{
if(llDetectedType(0) & AGENT)
{
llSay(0, llDetectedName(0) + " has been hit.");
}
}
Jaser Newell
Registered User
Join date: 12 Sep 2006
Posts: 23
03-06-2007 14:27
Thanks, I was unable to find the proper way to do that in the wiki and what I had definitely wasn't working.