Jump to content

llRegionSayTo Object to Object


Rhemah
 Share

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

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

Recommended Posts

Please help :matte-motes-sour: 

I was thinking of using llRegionSayTo but using the object's uuid in the key will limit the usage of the script. I want to use this script to several objects but i don't know how to do it =(

 

//Object[A]
integer iChanMe = -12345;
default
{
state_entry()
{
llListen(iChanMe, "", NULL_KEY, "");
}
touch(integer itouch)
{
//Say something that only Object[B] will listen
}
listen( integer eiChannel, string eiName, key eiID, string eiMessage )
{
if(eiChannel = iChanMe)
{
if(eiMessage = "HiObject[A]")
{
//Say something back that only Object[B] will listen
}
else if (eiMessage = "heard something back")
{
llSay(0,"I hear you Object[B]");
}
}
}
}

 

////////////////////////////////////////////

 

 

//Object[B]
integer iChanMe = -12345;
default
{
state_entry()
{
llListen(iChanMe, "", NULL_KEY, "");
}
touch(integer itouch)
{
//Say something that only Object[A] will listen
}
listen( integer eiChannel, string eiName, key eiID, string eiMessage )
{
if(eiChannel = iChanMe)
{
if(eiMessage = "HiObject[B]")
{
//Say something back that only Object[A] will listen
}
else if (eiMessage = "heard something back")
{
llSay(0,"I hear you Object[A]");
}
}
}
}

Link to comment
Share on other sites

You'll have to use some method of grabbing each object's UUID before you start communicating with them. One way would be to have each object send out a ping every once in a while that just says, in effect, "I'm Bob's object and my UUID is xxxxxxxxxx".  Send that ping with llRegionSay so that all objects hear it and let each object keep its own list of the UUIDs it hears.  You'll have to do a bit of filtering to keep from saving the same UUID over and over again, but that's easy enough.  I'm sure you can come up with other variations on that general idea.

  • Like 1
Link to comment
Share on other sites

It might be good to start with a simpler goal.  Like using two objects to talk to each other.  Where they each know the others ID and the channel(s) they'll be using.

One thing to watch out for is using a single '=' in your if statements.  You want a double there: '=='

Your listen event will only 'hear' on channels you have handles for.  So unless you have used multiple llListen functions you will only 'hear' on the one channel you set up.  By the way, you should get in the habit of capturing the listen handles so you can release them later when they aren't needed anymore.

One way to set up object ot object communication is to listen to anyone until you 'hear' a message that tells let you know you're talking to the object you want.  Then remove your original listen handle and use a new llListen to listen to that specific ID you now know about.  Since you know their ID now you can use llRegionSayTo. 

Beyond that I'm not sure what would be helpful.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3423 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...