|
Eadoin Welles
Registered User
Join date: 5 Jan 2007
Posts: 149
|
05-08-2008 09:54
I have a script that is listening on a certain channel and act only if the caller is the owner of object. However, if I write a hud to send commands to the object, the string is no more the owner, but the hud, and the script does not work. How can I act if the command is sent by a hud owned by a certain owner? The script should not be activated by a hud owned by another owner on the SAME channel.
|
|
Krista Chaffe
Registered User
Join date: 16 Jun 2007
Posts: 96
|
05-08-2008 12:18
From: Eadoin Welles I have a script that is listening on a certain channel and act only if the caller is the owner of object. However, if I write a hud to send commands to the object, the string is no more the owner, but the hud, and the script does not work. How can I act if the command is sent by a hud owned by a certain owner? The script should not be activated by a hud owned by another owner on the SAME channel. check out llgetownerkey. That returns the key of the owner, then compare it to avatar's key. If they match you own it
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-08-2008 13:42
Also llGetOwnerKey() will return the key of the resident if that's the key it is given. So it returns the same thing for a resident AND all of the objects owned by that resident. Pretty useful. 
|
|
FireEyes Fauna
Registered User
Join date: 26 Apr 2004
Posts: 138
|
05-08-2008 15:12
Unless the object is in another region, then it will just function as llGetKey() and return it's own key.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-08-2008 15:25
From: FireEyes Fauna Unless the object is in another region, then it will just function as llGetKey() and return it's own key. True, but that's at least not a false positive. If llGetOwnerKey(id) == avatarKey, then id is either avatarKey or an object that belongs to avatarKey.
|
|
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
|
05-08-2008 19:20
From: Hewee Zetkin True, but that's at least not a false positive. If llGetOwnerKey(id) == avatarKey, then id is either avatarKey or an object that belongs to avatarKey. No, you shouldn't be asking that...instead: From: someone if (llGetOwnerKey(id) == llGetOwner()) { // I'm getting a message from an object that belongs to the owner or from the owner itslef } If you want to make it strict so the owner can NOT send messages to the object, but objects that belongs to owner CAN send messages: From: someone if (llGetOwnerKey(id) == llGetOwner() && (id != llGetOwnerKey(id))) { // I'm getting a message from an object that belongs to the owner }
This is because, according to lslwiki: From: someone key llGetOwnerKey(keyid) ... If an avatar key is passed to this function, the result is the avatars key.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-08-2008 21:12
From: Kahiro Watanabe No, you shouldn't be asking that...instead.... I was speaking in general about the utility of the llGetOwnerKey() function, which you could use much more generally than limiting an event's functionality to the owner. Certainly if that is the application you want, you can replace 'avatarKey' in my example with 'llGetOwner()'.
|