Jump to content
Sign in to follow this  
Rubberene

HUD/Attachment owner only communication

Recommended Posts

I've googled this, but since it must be a fairly common thing, I must not be searching the right terms. This is for a product, and I need to ensure that if there are two avatars at the same place with the same item that their attachments won't listen to each other's HUDs. 

To state the obvious, with the two example scripts, this is exactly what happens, If I use "llListen( 3, "", llGetOwner(), "" );", then, of course, the attachment won't listen to the HUD. 

 

HUD Script:

list buttons = ["Scare", "Sound"];
string msg = "Select an option:";

key Owner;
integer channel_dialog;
integer listen_id;
default{
state_entry() {
Owner = llGetOwner();
channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
}

touch_start(integer total_number) {
if(llDetectedKey(0)==Owner){
llDialog(Owner, msg, buttons, channel_dialog);
listen_id = llListen( channel_dialog, "", Owner, "");

}
}


listen(integer channel, string name, key id, string choice) {
if (choice == "-") {
llDialog(Owner, msg,buttons, channel_dialog);
}
else if (choice == "Scare") {
llSay(3, "Scare");
llListenRemove(listen_id);
}
else if (choice == "Sound") {
llSay(3, "Sound");
llListenRemove(listen_id);
}


}

timer() {
llListenRemove(listen_id);
llSetTimerEvent(0.0);
}

 on_rez(integer start_param)
    {
        llResetScript();
    } 
}

 

 

Attachment script:

default
{

    state_entry() {
        llListen(3,"", NULL_KEY, "");
    }

    listen(integer channel, string name, key id, string message) {
        if (message == "Scare") {llSay(0, "Boo!"); state default;}{
        if (message == "Sound") {llPlaySound("ed124764-705d-d497-167a-182cd9fa2e6c",1); state default;}{
      
        
        
        }
    }
}
}

 

 

There must be a simple way to fix this. Any help will be muchly appreciated. ;)

Share this post


Link to post
Share on other sites

I have copied this script snippet from Innula Zenovka. She has posted it in another thread just a few days ago. This should do the job:

 

if(llGetOwnerKey(id)==llGetOwner()){

//then the message is from an object belonging to my owner

//do the stuff I should do

}

Share this post


Link to post
Share on other sites


Estelle Pienaar wrote:

Easiest method, but absolutely no security. If a product ever gets popular and a griefer searches the channels for the communication, he/she can send commands to your customers attachments! 

See also this discussion:

 

You don't need to lecture me on security. I was lead developer for the DCS2 combat meter for a while. I was merely responding within the scope of the original message which requested assistance in ensuring there wouldn't be any cross talk between hud and avatar attachment. If you really want, you can create a hash so that everyone's hud/attachment picks a communication channel unique to that avatar so that it doesn't matter if a griefer scans out their own channel number...yours will be different. You could even go further to encrypt all channel comms but the original poster did not specify the need for any of these options.

Share this post


Link to post
Share on other sites

Yeah, but the OP did say it was for a product, so it was probably good information for her to be aware of.  :smileywink:

Share this post


Link to post
Share on other sites

Creating a hash for unique channels sounds like an interesting idea to check out. 

Just to add to the list of possible security measures: A scripter could create a "hash ID" by taking the value of minutes from llGetTimeStamp at the moment the message is sent, run them through a function, shorten it e.g. to the first four digits and add them to the string which is sent by the HUD. Make the same mathematical calculations in the receiving attachment and check if the numbers are identical. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...