Jump to content

User-identification without the key..?


Kira Summerwind
 Share

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

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

Recommended Posts

Happy (slightly belated) New Year, everyone.

I currently try to set up communications between a prim attached to the user's body and a HUD. So basically an integer in the HUD that switches whenever the prim gets attached/detached.

 

    attach(key attached){
        

        if (attached == NULL_KEY)  // Object has been detached
        {
           llSay(-888,"Object Off");            
        }
        
        else   // Object has been attached
        {
          llSay(-888,"Object On");       
        }
    listen(integer channel, string name, key id, string message)
    {
         if (llGetOwnerKey(id) == llGetOwner()){
    
             if(message == "Object Off"){ 
                 state = 0;
                 llSay(0,"You put the object off.");
                 }
                 
             if(message == "Object On"){
                 state = 1;
                 llSay(0,"You put the object on.");
                 }    
              }
        }   

 I check the OwnerKey to prevent everyone in range with the same items doing the same command as the user. The trouble is that the prim-key at the detaching-message is NULL and can't be used for the Ownercheck. Now I kind of hit a dead-end. I already considered adding the key as a string + the command in the message but I wonder if there are simpler solutions. Is there another way to check if the prim  belongs to someone without using the key or maybe an alternative to send the Detach-message?

 

Thank you, Kira

Link to comment
Share on other sites

  

steph Arnott wrote:

llListen(-888, "", llGetOwner(), "");

makes more sense to me.

It makes no sense whatsoever to me, since the owner -- being an agent -- is never going to say anything on a negative channel, unless it's via llDialog.

If you test, in the listen event, for if(llGetOwnerKey(id)==llGetOwner()), what that means in English is "if whatever has just spoken to me is either my owner or belongs to my owner."    That's a perfectly sensible test.

If your listener is llListen(99,"",llGetOwner(),"")  it's not going to hear messages from scripted objects belonging to your owner, since the objects' uuids are not the same as the uuid of the agent to whom they belong.

If your listener is llListen(99, "","","") it'll hear messages from the objects, certainly, but it will hear from all objects sending messages on channel 99, regardless of who owns them.

If the script needs to filter for messages on channel 99 from objects belonging to its owner, which is something I frequently need to do, then the listener llListen(99, "","","") and, in the listen event, the filter if(llGetOwnerKey(id)==llGetOwner) is a sensible way to do it.

  • Like 1
Link to comment
Share on other sites

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