Jump to content
  • 0

Having trouble on getting my HuD and A Prim To communicate with each other. It needs unique ID!


Johan Bizet
 Share

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

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

Question

I am trying to get my HUD to talk or send a message to my Prim, But it has to be unique for else everyone would be animating each other.... i want it to only effect the owner.

 

Within my hud i have this:

touch_start(integer total_number)
{
emote=llList2String(action_list,nPos);

llSay(5,emote);
}

 

and in my Prim i have this:

 llListen(5, "", llGetOwner(), "");

 

This will not work at the moment But if i would change llGetOwner()  to  Null... then it would work....but not as i wanted it...

So if you press to smile.... you should smile alone.....

Can someone Help me please!, Been struggling with this for hours!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Johan,

You need to repost this question in the Scripters forum.

http://community.secondlife.com/t5/LSL-Scripting/bd-p/LSLScripting

:cathappy:

 

Rolig - I like the unique channel number calculator - Now all he needs to do is find a way for that to be calculated at rezz time and have it automatically inserted into the HUD & Prim listen code. Or can that same snippet be used to derive the same listen channel in the listening prim script and the HUD prim based on the owner UUID?

Link to comment
Share on other sites

  • 0

In the prim, try doing it this way instead....

 

llListen(5,"","","");listen (integer channel, string name, key id, string msg){    if (llGetOwnerKey(id) == llGetOwner())   {       //do stuff   }}

Incidentally, it's wise to use a negative channel number if you have objects speaking to each other.  That makes it harder for an avatar to spoof your message.  Also, use a high integer like -92733817, that's not likely to be used by anyone else. It reduces the possibility of crosstalk and cuts load on the servers.

Another method, of course, is to calculate a channel number that is unique to your avatar.  That way, several people can use the same script at once and not interfere with each other.

integer channel_no = (integer) ("0xF" + llGetSubString(llGetOwner(),0,6));llListen(channel_no,"","","");

 Put that channel_no in both the HUD and your prim.  They'll talk to each other just fine and ignore anyone else's HUD.

 

  • Like 1
Link to comment
Share on other sites

  • 0

If that's in the state_entry event, the calculated channel number will be assigned automatically whenever the script is reset. Yes, you could force the reset on rez or on attach. So long as that calculation is done in any scripted objects that are meant to use the same channel, they will be able to talk to each other and will ignore messages from similar scripted objects that have a different owner. As an aside, because many scripters use this method, I find it wise to add a different offset integer to the calculated channel number for each different script I write. That way, my door won't pay attention to the same "ON" message that activates my parcel radio, even though I own them both.

Link to comment
Share on other sites

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