|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
07-14-2007 16:26
Hi! I am trying to sense a specific object worn by an avatar, but the script fails to report the object when the object is actually worn by an avatar. If I place the object infront of the sensor without being attached to an avatar, the sensor sees it ok. When worn, the sensor does not see it at all. I am really struggling with this and any help would be very much appreciated. default { state_entry() { llSensorRepeat("", NULL_KEY, AGENT | ACTIVE | PASSIVE | SCRIPTED, 2.0, PI/2, 1); llOwnerSay("Sensor initialised..."); } sensor(integer num_detected) { integer i; for(i = 0; i < num_detected; i++) { if ((string)llDetectedName(i) == "specific object") { llOwnerSay("specific object detected with scan range"); } } } }
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
07-14-2007 16:46
Right, it won't work with a sensor. See  , to wit: From: someone Q: Can I use sensors to detect attachments? A: No, but you can use llGetAgentInfo to determine whether or not an avatar has attachments, and whether or not they're scripted, though not how many attachments they have, where they're attached, nor what they are. One can, however, script an attachment to respond to a query, so instead of trying to sense it, one can just ask it whether it's there, just using a pair of llListen()s and llSays()s on obscure channels.
|
|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
07-14-2007 17:03
Ahh, I get it now.
Thanks for your help Qie. I need an object to communicate with an attached object. Basically, the avatar has a worn attachment, the avatar walks within range of the sensor and the sensor script does 'something' when the avatar is wearing the correct attachment, so if I use the fixed object to sense any avatar within range, then llSay(message), if the avatar is wearing the specific object and the message is correct, then the attached object can return llSay(message) back to the fixed object, and then the fixed object can run its course.
Please correct me if I am wrong with this, but i think this is right.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
07-15-2007 07:34
From: Adelle Fitzgerald Ahh, I get it now.
Thanks for your help Qie. I need an object to communicate with an attached object. Basically, the avatar has a worn attachment, the avatar walks within range of the sensor and the sensor script does 'something' when the avatar is wearing the correct attachment, so if I use the fixed object to sense any avatar within range, then llSay(message), if the avatar is wearing the specific object and the message is correct, then the attached object can return llSay(message) back to the fixed object, and then the fixed object can run its course.
Please correct me if I am wrong with this, but i think this is right. Correct although you may want to check that the responce comes from the attachment of the avatar you detected rather than another who may just be within listen/chat distance.
_____________________
I'm back......
|
|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
07-16-2007 13:57
Thanks Newgate. I've managed to sort the script now. It works like this: Avatar walks in sensor range sensor script says a message on an obscure channel object worn on avatar filters the specific message on the obscure channel and says a response on another obscure channel sensor script filters message and if the resonse is right does its job  Thanks for you help, both of you 
|