Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need some Help with a Sensor

Cyrus Odets
Registered User
Join date: 5 Oct 2005
Posts: 51
04-30-2006 21:52
Howdy,

I'm having a bit of a problem with setting up a sensor and was hoping someone could help me out.

I'm trying to do the following:

allow the user to type in an Object and/or avatar name into the command line...

Then I'd like to open a sensor and sense for the avatar name OR object name that the person entered.

I've used a llSensor configured as such:

targetName = (retrieved from user-entry at the command line)
llSensor(targetName, NULL_KEY, AGENT | PASSIVE | ACTIVE | SCRIPTED, 50, PI);

As you can see, the user COULD type in the name of an object, or they COULD type in the name of another avatar. Whatever they type in...I'd like the sensor to search for .

However it seems that, when configured as above, it ONLY detects scripted objects. It can't seem to detect avatars or objects with no script in them.

Anyone tell me what I'm doing wrong or how to configure this to make it work?

Thanks!
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
04-30-2006 22:38
Check out this page in the Wiki; I think it will answer a lot of your questions regarding the use of llSensor. :)

http://secondlife.com/badgeo/wakka.php?wakka=llSensor
Cyrus Odets
Registered User
Join date: 5 Oct 2005
Posts: 51
05-01-2006 10:02
Thanks Talarus,

Unfortunately I read all the Wiki stuff on both llSensor, llSensorRepeat, and the sensor & no_sensor events, plus the 'general' heading on sensor. Either I'm mis-understanding what I'm reading...or something isn't working right.

From: someone
Values can be combined to search in multiple categories using bitwise OR (|). For example, llSensor("", NULL_KEY, AGENT | ACTIVE, 25, PI) would search for both agents and physical objects.


That is exactly what I tried, except using AGENT | PASSIVE | SCRIPTED.

So far, I'm interpreting this as "Send out a sensor to detect any agent, passive, or scripted that has a name or key that matches the search criteria specified in the llSensor line.

But maybe its the other way around...and it REALLY is saying "Send out a sensor to detect anything that is an AGENT and PASS and SCRIPTED. And because nothing can be all of those things...nothing is detected.

I'm not exactly use how to use that information with what I'm trying to do.

The user will type in a 'name' on the command line. That 'name' that they type in could be the name of an unscripted object laying around the area, it could be the name of a scripted object laying around the area, or it could be the name of an agent. Whatever they type in, thats what I want the sensor to detect.

So, for example, if the user typed in "Cyrus Odets"....I'd want to send out a sensor pulse that checks all nearby unscripted objects, scripted objects, AND avatars to see if any of those surrounding objects have a name that matches "Cyrus Odets".

Hope that makes sense :)
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
05-01-2006 13:17
I've done some playing around, and sensors... well, they act really stupidly when combined with the SCRIPTED bitflag:

SCRIPTED or AGENT | SCRIPTED - only detects objects with active scripts, or moving physical objects that contain a script (running or otherwise).

ACTIVE | SCRIPTED - only detects objects with running scripts, or moving physical objects only if they contain a script (running or otherwise).

PASSIVE | SCRIPTED - detects scripted and non-scripted, non-physical objects, does not detect physical objects at all unless they are scripted (running or otherwise).

Combinations that don't include SCRIPTED seem to be behave as you'd think they would. So you'll probably want to use AGENT | ACTIVE | PASSIVE if you want to detect all of the objects in the environment around you, or as close to all of them as possible.
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
Cyrus Odets
Registered User
Join date: 5 Oct 2005
Posts: 51
05-01-2006 14:36
Yup!

That did the trick :) AGENT | ACTIVE | PASSIVE.

It was the SCRIPTED entry that was throwing a wrench in the works.

Thanks again Cross!
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-01-2006 14:37
From the llSensorRepeat page in the Wiki (comments after the flag info):

From: someone
Q: ORing sensor types was broken for a long time, is it for sure fixed now?
A: It still seems to be broken as of 2004/08/23.
A: Still mostly broken as of 2005/10/16. AGENT|ACTIVE doesn't work, AGENT|PASSIVE doesn't work, AGENT|SCRIPTED doesn't work, but PASSIVE|ACTIVE does.


I haven't verfied that comment 100% myself, but I remember having some issues with combining flags that caused the sensor to not work or to work spotty at best. Following these rules seems to be the best bet, IMO.
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
05-01-2006 14:51
Actually, most of those work when I test them. AGENT | ACTIVE | PASSIVE seems to detect pretty much everything in the vicinity of the script. The only time I've noticed things acting weird is when SCRIPTED gets thrown into the mix. It seems to act like a filter than a detection parameter: instead of telling the sensor to look for everything plus scripts, it seems to tell it to look for only those things containing scripts which also match the other flags. Which explains why AGENT | SCRIPTED doesn't work, since avatars can't contain scripts!

I've tested a sensor with all the different types, and sensor flag ORing seems to behaving normally. I've updated the note on the wiki regarding this under llSensorRepeat().
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"