Jump to content

Detect Attachment (Name)


joniveehernandez
 Share

You are about to reply to a thread that has been inactive for 4165 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi Guys need some suggestions, an object is detecting all agents in a parcel every 5 seconds then the I need to check all the agents one by one if its currently wearing the attachment that I gave. The idea is don't give the agent another same attachment if he/she already wearing that attachment and vice-versa give them the attachment is the agent is not wearing that specific attachment.

Now I was thinking to detect all the attachment name of an agent, is that possible? ~Thanks

Link to comment
Share on other sites

No, that's not possible.  All you can do is put a script in the attachment that will respond to a ping from your detector.  When your detector says "Hello!" or whatever, each attachment in the sim says the UUID of the person wearing it.  Once you have that list, you can compare it to a list of all avatars in the sim and decide who else should get one.

Link to comment
Share on other sites

Nope.  You can only detect if someone is wearing scripted attachments (which could be anything), but not what they are.

However, why not take advantage of the fact that messages sent with llRegionSayTo(id, chan, message) are, if the id is that of an avatar, heard by all that avatar's attachments (and only that avatar's attachments) that happen to be listening on chan?

So when you detect someone new,  send her or him a message using llRegionSayTo (I'd calculate a special channel based on that avatar's uuid, and open a listener based on it, too) and see if you get a reply from the hud.   If you don't, then you can offer one.

For an example of how to calculate integers from uuids (very useful trick) see Key2Number in the wiki.

Link to comment
Share on other sites

e.g. If I ping 5 channels for attachment, I want to tell my script that it will only proceed the execution after listening to those channel for possible response to HUDs.

Or shall I say after I collected all the ping response which is the UUID of the wearer then I'll proceed to my next process comparing those UUIDs to all detected agents.


A simplified example script:

touch_start(integer total_number)
{
          listener = llListen(-123456, "", "", ""); // listen here for hud response

          llRegionSay(-100000, "PING"); // ping huds for in this channel

          llOwnerSay(llDumpList2String(agents_with_hud, "\n")); // display UUIDs of all the agents with attachment
}

listen(integer channel, string name, key id, string message)
{
          agents_with_hud += (key) message; // list of UUIDs from hud response

}

 

the red text is the problem there where in it will return empty even there are response from that channel because I think the listen event will trigger only after the current event which is the touch_start. or shall I say no multiple events can be triggered at the same time in a single script (correct me if I'm wrong). Is there any suggestion you can give me guys? ~Thanks

Link to comment
Share on other sites

In the touch event, you can't catch the responses. Give the attachments a little time to respond, collect them during that time, and at the end of the interval, say your keys.

touch_start(integer total_number){		  agents_with_hud = [];          listener = llListen(-123456, "", "", ""); // listen here for hud response          llRegionSay(-100000, "PING"); // ping huds for in this channel          llSetTimerEvent(3.0);}listen(integer channel, string name, key id, string message){          agents_with_hud += (key) message; // list of UUIDs from hud response}timer() {	llListenRemove(listener);
llSetTimerEvent(0); llOwnerSay(llDumpList2String(agents_with_hud, "\n")); // display UUIDs of all the agents with attachment}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4165 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...